Skip to content
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

Issue 4596 - Build with clang/lld fails when LTO enabled #6392

Merged
merged 2 commits into from
Jan 24, 2025

Conversation

vashirov
Copy link
Member

@vashirov vashirov commented Nov 1, 2024

Issue 4596 - Build with clang/lld fails when LTO enabled

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: #4596

Reviewed by: ???

@vashirov
Copy link
Member Author

vashirov commented Nov 1, 2024

This PR is a copy of #4929 which got closed when I recreated my fork. Last time there was an issue building with gcc. I tried today to build it on F40 and the build was successful. So giving it another try.

@vashirov
Copy link
Member Author

vashirov commented Nov 1, 2024

gcc compilation pipeline failed with:

/usr/bin/ld: ldap/servers/snmp/agent-main.o: relocation R_X86_64_32 against `.rodata.str1.8' can not be used when making a PIE object; recompile with -fPIE

@vashirov
Copy link
Member Author

vashirov commented Nov 4, 2024

Pipeline is fixed, compilation with gcc is now successful.

Copy link
Member

@droideck droideck left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Also, I checked, and it builds on CentOS 10 too.

Firstyear and others added 2 commits January 23, 2025 11:46
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 <[email protected]>

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: @droideck (Thanks!)
@vashirov vashirov merged commit 75c9dcd into 389ds:main Jan 24, 2025
198 of 199 checks passed
@vashirov vashirov deleted the i4920 branch January 24, 2025 16:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build with clang/lld fails with undefined reference error when LTO is enabled
3 participants