Page MenuHomeFreeBSD

Add LLD_UNSAFE to force use of ld.bfd when ld is lld
ClosedPublic

Authored by emaste on Aug 17 2017, 1:30 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Apr 19, 2:49 PM
Unknown Object (File)
Tue, Apr 9, 7:40 AM
Unknown Object (File)
Tue, Apr 9, 5:53 AM
Unknown Object (File)
Tue, Apr 2, 4:30 PM
Unknown Object (File)
Fri, Mar 29, 1:40 PM
Unknown Object (File)
Mar 12 2024, 3:50 PM
Unknown Object (File)
Feb 9 2024, 10:10 AM
Unknown Object (File)
Jan 20 2024, 7:29 PM
Subscribers
None

Details

Summary

By default the compiler will find /usr/bin/ld for the linker. If the port sets LLD_UNSAFE and /usr/bin/ld is ld.lld, then add -fuse-ld=bfd to force the use of the binutils BFD linker (from the base system, if available, or by setting USE_BINUTILS).

Based on an earlier, similar patch from bapt.

Diff Detail

Repository
rP FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

For reference, the reason devel/libunwind does not work with LLD:

devel/libunwind: mark as LLD_UNSAFE

libunwind.so has symbols with ELF protected visibility which various
test applications attempt to preempt. Both GNU gold and LLVM's lld
fail to link this case, with errors like

lld:
/usr/bin/ld: error: cannot preempt symbol: _ULx86_64_init_local
>>> defined in ../src/.libs/libunwind.so
>>> referenced by Lperf-trace.c
>>>               Lperf-trace.o:(main)

gold:
/usr/local/bin/ld.gold: error: Gperf-simple.o: cannot make copy relocation
    for protected symbol '_Ux86_64_local_addr_space', defined in
    ../src/.libs/libunwind-x86_64.so

looks good to me as it is based on my own patch :)

This revision is now accepted and ready to land.Aug 17 2017, 1:53 PM
This revision was automatically updated to reflect the committed changes.