Bugzilla – Bug 1142709
-flto breaks function wrapping
Last modified: 2019-07-25 09:48:27 UTC
Function wrapping is broken with -flto e.g. package osmo-sgsn https://build.opensuse.org/package/show/openSUSE:Factory/osmo-sgsn ---snip--- [ 20s] make[3]: Entering directory '/home/abuild/rpmbuild/BUILD/osmo-sgsn-1.4.0.29/tests/gbproxy' [ 20s] CC gbproxy_test.o [ 20s] CCLD gbproxy_test [ 22s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /tmp/gbproxy_test.Vzl0RE.ltrans0.ltrans.o: in function `gbproxy_make_sgsn_tlli': [ 22s] /home/abuild/rpmbuild/BUILD/osmo-sgsn-1.4.0.29/tests/gbproxy/gb_proxy.c:278: undefined reference to `__wrap_osmo_get_rand_id' [ 22s] /usr/lib64/gcc/x86_64-suse-linux/9/../../../../x86_64-suse-linux/bin/ld: /tmp/gbproxy_test.Vzl0RE.ltrans0.ltrans.o: in function `gbprox_process_bssgp_dl.constprop.0': [ 22s] /home/abuild/rpmbuild/BUILD/osmo-sgsn-1.4.0.29/tests/gbproxy/gb_proxy.c:240: undefined reference to `__wrap_osmo_get_rand_id' [ 22s] collect2: error: ld returned 1 exit status [ 22s] make[3]: *** [Makefile:437: gbproxy_test] Error 1 ---snip--- Also see: https://osmocom.org/issues/4116 It also seems to be a known issue: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88643
Yeah, please disable the use of LTO if you rely on -Wl,--wrap. Tracking upstream.