5.2.0-r3 built/runs fine. Not sure why -r50 is failing.
Created attachment 699321 [details] build log
Building with GCC 9.3.0 succeeded, so this appears to be a GCC 10.2.0 related issue.
Could you attach emerge --info for completeness? Haven't tried gcc9 but I can reproduce only if I use CFLAGS="-Og" I'd guess the latter got used in the following and isn't being found: #if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) void unknown_lock_type(void *); #else static inline void unknown_lock_type(void *unused) [...]
Created attachment 699324 [details] emerge --info Indeed, I do use -Og for everything.
Your build.log suggests you are using '-Og -pipe -fomit-frame-pointer -mcpu=power9 -mno-isel -ggdb3' and not just '-Og'. 1. Does it fail with '-Og'? 2. Does ot fail with '-Og' on amd64? Both build.logs might be useful to compare against one another.
(In reply to Sergei Trofimovich from comment #5) > 1. Does it fail with '-Og'? > 2. Does ot fail with '-Og' on amd64? As I mentioned in comment #3 I was able to reproduce with just CFLAGS=-Og, and to answer #2, this was on ~amd64
Created attachment 699357 [details] alternate amd64 -Og build.log + emerge --info (In reply to Ionen Wolkens from comment #6) > As I mentioned in comment #3 I was able to reproduce with just CFLAGS=-Og, > and to answer #2, this was on ~amd64 Attaching my own logs as well for reference.
Thank you! That's useful. The code relies on dead code elimination to get rid of references. Looks like -O1 is fine while -Og is not. $ diff -U0 <(gcc -dM -E - </dev/null) <(gcc -Og -dM -E - </dev/null) --- /dev/fd/63 2021-04-12 17:57:27.614567285 +0100 +++ /dev/fd/62 2021-04-12 17:57:27.614567285 +0100 @@ -53,0 +54 @@ +#define __OPTIMIZE__ 1 @@ -65,0 +67 @@ +#define _FORTIFY_SOURCE 2 @@ -161 +162,0 @@ -#define __NO_INLINE__ 1 $ diff -U0 <(gcc -Og -Q --help=optimizers) <(gcc -O1 -Q --help=optimizers) --- /dev/fd/63 2021-04-12 18:00:19.097007226 +0100 +++ /dev/fd/62 2021-04-12 18:00:19.097007226 +0100 @@ -22 +22 @@ - -fbranch-count-reg [disabled] + -fbranch-count-reg [enabled] @@ -41 +41 @@ - -fdse [disabled] + -fdse [enabled] @@ -64,2 +64,2 @@ - -fif-conversion [disabled] - -fif-conversion2 [disabled] + -fif-conversion [enabled] + -fif-conversion2 [enabled] @@ -70 +70 @@ - -finline-functions-called-once [disabled] + -finline-functions-called-once [enabled] @@ -78 +78 @@ - -fipa-modref [disabled] + -fipa-modref [enabled] @@ -113 +113 @@ - -fmove-loop-invariants [disabled] + -fmove-loop-invariants [enabled] @@ -185 +185 @@ - -fssa-phiopt [disabled] + -fssa-phiopt [enabled] @@ -204 +204 @@ - -ftree-bit-ccp [disabled] + -ftree-bit-ccp [enabled] @@ -213 +213 @@ - -ftree-dse [disabled] + -ftree-dse [enabled] @@ -228 +228 @@ - -ftree-pta [disabled] + -ftree-pta [enabled] @@ -234 +234 @@ - -ftree-sra [disabled] + -ftree-sra [enabled] Note that -ftree-dse is disabled for -Og and that retains external references. We can turn original code to always be a runtime switch from include/qemu/lockable.h: /* This function gives an error if an invalid, non-NULL pointer type is passed * to QEMU_MAKE_LOCKABLE. For optimized builds, we can rely on dead-code elimination * from the compiler, and give the errors already at link time. */ #if defined(__OPTIMIZE__) && !defined(__SANITIZE_ADDRESS__) void unknown_lock_type(void *); #else static inline void unknown_lock_type(void *unused) { abort(); } #endif
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=957314a3054fd202618a5a44c076cbcda8c711d5 commit 957314a3054fd202618a5a44c076cbcda8c711d5 Author: Sergei Trofimovich <slyfox@gentoo.org> AuthorDate: 2021-04-12 19:37:55 +0000 Commit: Sergei Trofimovich <slyfox@gentoo.org> CommitDate: 2021-04-12 19:39:33 +0000 app-emulation/qemu: Do not rely on DCE for lock type test Fix CFLAGS=-Og build break. -Og fails because gcc does not enable dead code elimination (but does set __OPTIMIZE__ define). The fix avoids DCE reliance downstream entirely. Reported-by: Luke-Jr Closes: https://bugs.gentoo.org/782364 Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org> app-emulation/qemu/files/qemu-5.2.0-dce-locks.patch | 18 ++++++++++++++++++ app-emulation/qemu/qemu-5.2.0-r50.ebuild | 1 + app-emulation/qemu/qemu-9999.ebuild | 1 + 3 files changed, 20 insertions(+)