Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 951162 - sys-devel/binutils-2.44[pgo] reproducibly fails with `-Werror=coverage-mismatch`
Summary: sys-devel/binutils-2.44[pgo] reproducibly fails with `-Werror=coverage-mismatch`
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal
Assignee: Gentoo Toolchain Maintainers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-03-11 12:16 UTC by Stuart Shelton
Modified: 2025-03-11 13:59 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
build.log.gz (binutils-2.44:20250311-122110.log.gz,86.63 KB, application/x-gzip)
2025-03-11 12:35 UTC, Stuart Shelton
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stuart Shelton 2025-03-11 12:16:55 UTC
Prior stable package versions have all built successfully with the same CFLAGS/etc in the same environment:

```
make[4]: Entering directory '/var/tmp/portage/sys-devel/binutils-2.44/work/build/ld'
x86_64-pc-linux-gnu-gcc -DHAVE_CONFIG_H -I. -I/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld  -I. -I/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld -I../bfd -I/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/../bfd -I/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/../include  -march=skylake -O3 -mtls-dialect=gnu2 -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch -Wp,-D_REENTRANT -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,-z,relro -Wl,--enable-new-dtags -Wl,--sort-common -Wl,-z,separate-code -pipe   -fprofile-use -flto=jobserver -ffat-lto-objects -DLOCALEDIR="\"/usr/share/binutils-data/x86_64-pc-linux-gnu/2.44/locale\"" -Wp,-D_REENTRANT -W -Wall -Wstrict-prototypes -Wmissing-prototypes -Wshadow -Wstack-usage=262144 -DELF_LIST_OPTIONS=true -DELF_SHLIB_LIST_OPTIONS=true -DELF_PLT_UNWIND_LIST_OPTIONS=true   -march=skylake -O3 -mtls-dialect=gnu2 -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch -Wp,-D_REENTRANT -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,-z,relro -Wl,--enable-new-dtags -Wl,--sort-common -Wl,-z,separate-code -pipe   -fprofile-use -flto=jobserver -ffat-lto-objects -c -o ldbuildid.o /var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/ldbuildid.c
/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/ldbuildid.c: In function 'generate_build_id':
/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/ldbuildid.c:119:1: error: number of counters in profile data for function 'generate_build_id' does not match its profile data (counter 'arcs', expected 39 and have 41) [-Werror=coverage-mismatch]
  119 | generate_build_id (bfd *abfd,
      | ^~~~~~~~~~~~~~~~~
/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/ldbuildid.c:119:1: error: number of counters in profile data for function 'generate_build_id' does not match its profile data (counter 'indirect_call', expected 14 and have 9) [-Werror=coverage-mismatch]
/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44/ld/ldbuildid.c:119:1: error: the control flow of function 'generate_build_id' does not match its profile data (counter 'time_profiler') [-Werror=coverage-mismatch]
cc1: some warnings being treated as errors
make[4]: *** [Makefile:1617: ldbuildid.o] Error 1
make[4]: Leaving directory '/var/tmp/portage/sys-devel/binutils-2.44/work/build/ld'
make[3]: *** [Makefile:1899: all-recursive] Error 1
make[2]: *** [Makefile:1090: all] Error 2
make[1]: *** [Makefile:7708: all-ld] Error 2
make: *** [Makefile:1028: all] Error 2
 * ERROR: sys-devel/binutils-2.44::gentoo failed (compile phase):
 *   emake failed
 *
 * If you need support, post the output of `emerge --info '=sys-devel/binutils-2.44'`,
 * the complete build log and the output of `emerge -pqv '=sys-devel/binutils-2.44'`.
 * The complete build log is located at '/var/log/portage/build/sys-devel/binutils-2.44:20250311-114410.log.gz'.
 * For convenience, a symlink to the build log is located at '/var/tmp/portage/sys-devel/binutils-2.44/temp/build.log.gz'.
 * The ebuild environment file is located at '/var/tmp/portage/sys-devel/binutils-2.44/temp/environment'.
 * Working directory: '/var/tmp/portage/sys-devel/binutils-2.44/work/build'
 * S: '/var/tmp/portage/sys-devel/binutils-2.44/work/binutils-2.44'
```

```
$ emerge --info
Portage 3.0.66.1 (python 3.12.8-final-0, default/linux/amd64/23.0/split-usr/no-multilib, gcc-14, glibc-2.40_p697-r8, 6.13.2-gentoo x86_64)
=================================================================
System uname: Linux-6.13.2-gentoo-x86_64-Intel-R-_Xeon-R-_CPU_E3-1240L_v5_@_2.10GHz-with-glibc2.40
KiB Mem:    65748156 total,   1243472 free
KiB Swap:   41943020 total,  41940972 free
Timestamp of repository gentoo: Mon, 10 Mar 2025 20:39:11 +0000
sh sys-apps/busybox 1.36.1-r3
ld GNU ld (Gentoo 2.44 p1) 2.44.0
app-misc/pax-utils:        1.3.8
app-shells/bash:           5.2_p37
dev-build/autoconf:        2.72-r1
dev-build/automake:        1.17-r1
dev-build/libtool:         2.5.4
dev-build/make:            4.4.1-r100
dev-lang/perl:             5.40.0-r1
dev-lang/python:           3.12.8_p1
sys-apps/baselayout:       2.17
sys-apps/openrc:           0.55.1
sys-apps/sandbox:          2.39
sys-devel/binutils:        2.44
sys-devel/binutils-config: 5.5.2
sys-devel/gcc:             14.2.1_p20241221
sys-devel/gcc-config:      2.12.1
sys-kernel/linux-headers:  6.6-r1 (virtual/os-headers)
sys-libs/glibc:            2.40-r8
Repositories:

gentoo
    location: /var/db/repo/gentoo
    sync-type: rsync
    sync-uri: rsync://rsync.europe.gentoo.org/gentoo-portage
    priority: -1000
    volatile: True
    sync-rsync-verify-max-age: 3
    sync-rsync-verify-jobs: 1
    sync-rsync-extra-opts: 
    sync-rsync-verify-metamanifest: no

=================================================================
                        Package Settings
=================================================================

sys-devel/binutils-2.44::srcshelton was built with the following:
USE="nls plugins xxhash zstd -cet -debuginfod -doc -gprofng -hardened -multitarget -pgo -static-libs -test -vanilla"
CFLAGS="-march=skylake -O3 -mtls-dialect=gnu2 -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch -flto -Wp,-D_REENTRANT -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,-z,relro -Wl,--enable-new-dtags -Wl,--sort-common -Wl,-z,separate-code -pipe"
CXXFLAGS="-march=skylake -O3 -mtls-dialect=gnu2 -Werror=odr -Werror=strict-aliasing -Werror=lto-type-mismatch -flto -Wp,-D_REENTRANT -Wl,-O1 -Wl,--as-needed -Wl,-z,pack-relative-relocs -Wl,-z,now -Wl,-z,relro -Wl,--enable-new-dtags -Wl,--sort-common -Wl,-z,separate-code -pipe"
```

```
$ emerge -pqv '=sys-devel/binutils-2.44'
[ebuild   R   ] sys-devel/binutils-2.44  USE="nls pgo* plugins xxhash zstd -cet -debuginfod -doc -gprofng -hardened -multitarget -static-libs -test -vanilla" 
```
Comment 1 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 12:19:47 UTC
Please include the full build.log.
Comment 2 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 12:20:15 UTC
> sys-devel/binutils-2.44::srcshelton

Some information on how your ebuild differs to the ::gentoo one -- or rather, reproducing it with the ::gentoo one, would be great.
Comment 3 Stuart Shelton 2025-03-11 12:20:26 UTC
(Minor correction: this package was /not/ built from an overlay, but I copied and pasted the wrong 'Package Settings' section - sorry!)
Comment 4 Stuart Shelton 2025-03-11 12:35:12 UTC
Created attachment 920575 [details]
build.log.gz

build.log (for ::gentoo ebuild) attached.
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 12:54:53 UTC
Looking at generate_build_id, it has a few conditionals but the most notable one being WITH_XXHASH.

ldbuildid.c gets built with identical args modulo -fprofile-{generate,use} in your log, which is good.

It only has one notable caller (write_build_id) where there's nothing interesting happening.

You'll have to try narrow it down a bit more, I'm afraid (I certainly can't reproduce yet). Start with trying when building binutils manually and then gradually adding in flags and the same configure options?
Comment 6 Stuart Shelton 2025-03-11 13:13:05 UTC
Sure, will do!
Comment 7 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2025-03-11 13:25:01 UTC
Thanks! Keep me posted. I'm happy to try poke once it's a bit clearer what's going on.
Comment 8 Stuart Shelton 2025-03-11 13:59:48 UTC
To confirm: with exactly the same setup and flags, building with USE='pgo -xxhash' works correctly - so there's some clash between these two options.