Bug 1142709 - -flto breaks function wrapping
-flto breaks function wrapping
Status: RESOLVED UPSTREAM
Classification: openSUSE
Product: openSUSE Tumbleweed
Classification: openSUSE
Component: Development
Current
Other Other
: P5 - None : Normal (vote)
: ---
Assigned To: Michael Matz
E-mail List
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2019-07-24 19:35 UTC by Martin Hauke
Modified: 2019-07-25 09:48 UTC (History)
1 user (show)

See Also:
Found By: ---
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Martin Hauke 2019-07-24 19:35:57 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
Comment 1 Richard Biener 2019-07-25 09:48:27 UTC
Yeah, please disable the use of LTO if you rely on -Wl,--wrap.  Tracking upstream.