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

Authored by emaste on Aug 17 2017, 1:30 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
emaste created this revision.Aug 17 2017, 1:30 PM

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
bapt accepted this revision.Aug 17 2017, 1:53 PM

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.