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
F132486832: D12064.diff
Fri, Oct 17, 8:10 AM
Unknown Object (File)
Sat, Oct 11, 12:31 AM
Unknown Object (File)
Wed, Oct 1, 5:24 AM
Unknown Object (File)
Thu, Sep 25, 4:48 PM
Unknown Object (File)
Tue, Sep 23, 12:34 PM
Unknown Object (File)
Fri, Sep 19, 3:17 AM
Unknown Object (File)
Thu, Sep 18, 9:04 PM
Unknown Object (File)
Wed, Sep 17, 10:14 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.