-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build with clang/lld fails with undefined reference error when LTO is enabled #4596
Comments
@vashirov Should we try using lto in our make/configure so that all developers are testing this regularly? I have been using clang 11 + rust recently, so I can check this for clang too. |
Also if we turn on LTO in C, we should consider it for rust as well. |
LTO is on by default in Fedora 33 and OpenSUSE Tumbleweed when rpm build is used. I use I don't have a strong opinion about adding it to make/configure though.
A profile in |
Well it looks like SUSE is doing it by default as well, so it would be best for us to "develop how it's used", which means we should enable LTO by default for us developers too. That's why I suggest we make it default. Yes, I think it's a profile flag according to https://doc.rust-lang.org/cargo/reference/profiles.html we probably want "thin". |
OK, I will submit a PR with the changes. |
@Firstyear, I need your help regarding fixing Rust code with LTO. IIUC, error messages in the description should be fixed by using |
Bug Description: Fedora is introducing lto by default which may affect our build especially with rust and asan Fix Description: Adapt how we use lto and how we link in our builds so that lto works for gcc. fixes: 389ds#4596 Author: William Brown <william@blackhats.net.au> Review by: ???
Bug Description: Fedora is introducing lto by default which may affect our build especially with rust and asan Fix Description: Adapt how we use lto and how we link in our builds so that lto works for gcc. fixes: 389ds#4596 Author: William Brown <william@blackhats.net.au> Review by: ???
Bug Description: Build with clang/lld fails with undefined reference error. ``` ld.lld: error: ./.libs/libslapd.so: undefined reference to __rust_probestack [--no-allow-shlib-undefined] ld.lld: error: ./.libs/libslapd.so: undefined reference to __muloti4 [--no-allow-shlib-undefined] ``` Fix Description: * Disabled GCC security flags when building with clang. * lld by default uses xxhash for build ids, which is too small for rpm (it requires it between 16 and 64 bytes in size), use sha1 instead. * Switch debug CFLAGS and LDFLAGS to use DWARF4 instead of DWARF5. * Disable LTO for clang rpm build. Fixes: 389ds#4596 Reviewed by: ???
Bug Description: Build with clang/lld fails with undefined reference error. ``` ld.lld: error: ./.libs/libslapd.so: undefined reference to __rust_probestack [--no-allow-shlib-undefined] ld.lld: error: ./.libs/libslapd.so: undefined reference to __muloti4 [--no-allow-shlib-undefined] ``` Fix Description: * Disabled GCC security flags when building with clang. * lld by default uses xxhash for build ids, which is too small for rpm (it requires it between 16 and 64 bytes in size), use sha1 instead. * Switch debug CFLAGS and LDFLAGS to use DWARF4 instead of DWARF5. * Disable LTO for clang rpm build. Fixes: 389ds#4596 Reviewed by: ???
Issue Description
In Fedora 33 LTO is enabled by default: https://fedoraproject.org/wiki/LTOByDefault
Build with clang/lld fails with undefined reference error.
Steps to Reproduce
On Fedora 33 with
If I disable LTO in the spec file, build succeeds:
The text was updated successfully, but these errors were encountered: