Created attachment 562208 [details] build.log compiles fine without LTO
Created attachment 562210 [details] emerge --info
> CFLAGS="-march=native -O3 -pipe -flto -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -mindirect-branch=thunk -mindirect-branch-register" > CXXFLAGS="-march=native -O3 -pipe -flto -floop-interchange -floop-strip-mine -floop-block -fgraphite-identity -mindirect-branch=thunk -mindirect-branch-register" Can you try to minimize CFLAGS/CXXFLAGS while the error is still observable? You can use https://wiki.gentoo.org/wiki/Gcc-ICE-reporting-guide#Expand_-march.3Dnative.2C_exact_gcc_version_and_other_system-specific_options to expand -march=native.
Will be fixed in 1.1.4 Fixed by commit: https://gitlab.com/cmocka/cmocka/commit/ee264da1aa222b354cee36184ab48c2072f62243 Upstream issue: https://gitlab.com/cmocka/cmocka/issues/14 MUST BE BUILD WITH: -DWITH_EXAMPLES=OFF
But that's not really a fix, is it?
Reproduced locally with C*FLAGS="-O2 -pipe -flto": # LANG=C make V=1 VERBOSE=1 /usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc -O2 -pipe -flto -fdiagnostics-show-option -frecord-gcc-switches -Wl,-O1 -Wl,--as-needed -O2 -pipe -flto -Wl,--hash-style=gnu -Wl,--wrap=uptime CMakeFiles/test_uptime.dir/test_uptime.c.o -o test_uptime -Wl,-rpath,/dev/shm/portage/dev-util/cmocka-1.1.3/work/cmocka-1.1.3-abi_x86_64.amd64/src ../../../src/libcmocka.so.0.5.1 /usr/lib/librt.so /usr/lib/gcc/x86_64-pc-linux-gnu/8.2.0/../../../../x86_64-pc-linux-gnu/bin/ld: /tmp/cc3ig6Xu.ltrans0.ltrans.o: in function `calc_uptime': <artificial>:(.text+0x46): undefined reference to `__wrap_uptime' collect2: error: ld returned 1 exit status I think gcc's lto driver does not understand semantics of -Wl,--wrap= symbol renaming.
Also registered in gcc upstream as https://gcc.gnu.org/PR88643
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=30c33c07c94332463b72487288d5b02372e64190 commit 30c33c07c94332463b72487288d5b02372e64190 Author: Andreas Sturmlechner <asturm@gentoo.org> AuthorDate: 2019-01-24 22:32:32 +0000 Commit: Andreas Sturmlechner <asturm@gentoo.org> CommitDate: 2019-01-24 22:59:33 +0000 dev-util/cmocka: Add USE examples, EAPI-7 bump Bug: https://bugs.gentoo.org/675876 Package-Manager: Portage-2.3.58, Repoman-2.3.12 Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org> dev-util/cmocka/cmocka-1.1.3.ebuild | 13 ++++--- dev-util/cmocka/files/cmocka-1.1.3-examples.patch | 45 +++++++++++++++++++++++ 2 files changed, 52 insertions(+), 6 deletions(-)
Apparently a gold bug.
*** Bug 877755 has been marked as a duplicate of this bug. ***
*** Bug 877741 has been marked as a duplicate of this bug. ***
See the discussion in bug 877741 but especially https://bugs.gentoo.org/877741#c9.
*** Bug 802762 has been marked as a duplicate of this bug. ***
*** Bug 871999 has been marked as a duplicate of this bug. ***
*** Bug 943725 has been marked as a duplicate of this bug. ***
*** Bug 865275 has been marked as a duplicate of this bug. ***
*** Bug 865997 has been marked as a duplicate of this bug. ***
*** Bug 865277 has been marked as a duplicate of this bug. ***
*** Bug 865279 has been marked as a duplicate of this bug. ***
*** Bug 729772 has been marked as a duplicate of this bug. ***