FreeBSD's migration to a full permissively-licensed modern tool chain is in progress. This PR will track the work necessary to move away from the obsolete GNU ld.bfd 2.17.50 to lld or external toolchain for all architectures. LLD status: ** x86 ** amd64: complete, lld is the bootstrap and system linker A small number of ports issues remain, tracked in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=214864 i386: proof of concept demonstrated with lld as bootstrap linker but some new issues have appeared, tracked in https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=225128 ** Arm ** arm64: complete, lld is the bootstrap and system linker armv7: proof of concept demonstrated, one known issue tracked in https://bugs.llvm.org/show_bug.cgi?id=36009 armv6 and lower: lld is currently not suitable ** MIPS ** The multi-GOT patch was finally committed upstream in https://reviews.llvm.org/rL334390. Proof of concept demonstrated using patched lld as MIPS linker. ** PPC ** LLD currently not functional as bootstrap linker ** sparc64 ** LLD lacks sparc64 support ** RISC-V ** LLD lacks usable RISC-V support
markj investigated the i386 issue and found a bug in lld partial linking (-r) and debug info, tracked in https://bugs.llvm.org/show_bug.cgi?id=37735
LLVM PR 37735 is fixed upstream - I am testing an import of the change now.
For armv7 see also https://lists.freebsd.org/pipermail/freebsd-toolchain/2018-January/003574.html >> this means that we can not use lld for kernel module linking. > > Right now for pre-v7 lld exits with the "may use" before attempting to > link, with no indication of whether movt/movw would actually be used. > > It seems in practice linking armv7 with lld does not use movt/movw.
A commit references this bug: Author: emaste Date: Tue Jul 31 15:25:03 UTC 2018 New revision: 336972 URL: https://svnweb.freebsd.org/changeset/base/336972 Log: lld: [ELF][ARM] Implement support for Tag_ABI_VFP_args The Tag_ABI_VFP_args build attribute controls the procedure call standard used for floating point parameters on ARM. The values are: 0 - Base AAPCS (FP Parameters passed in Core (Integer) registers 1 - VFP AAPCS (FP Parameters passed in FP registers) 2 - Toolchain specific (Neither Base or VFP) 3 - Compatible with all (No use of floating point parameters) If the Tag_ABI_VFP_args build attribute is missing it has an implicit value of 0. We use the attribute in two ways: * Detect a clash in calling convention between Base, VFP and Toolchain. we follow ld.bfd's lead and do not error if there is a clash between an implicit Base AAPCS caused by a missing attribute. Many projects including the hard-float (VFP AAPCS) version of glibc contain assembler files that do not use floating point but do not have Tag_ABI_VFP_args. * Set the EF_ARM_ABI_FLOAT_SOFT or EF_ARM_ABI_FLOAT_HARD ELF header flag for Base or VFP AAPCS respectively. This flag is used by some ELF loaders. References: * Addenda to, and Errata in, the ABI for the ARM Architecture for Tag_ABI_VFP_args * Elf for the ARM Architecture for ELF header flags Fixes LLVM PR36009 PR: 229050 Obtained from: llvm r338377 by Peter Smith Changes: head/contrib/llvm/tools/lld/ELF/Arch/ARM.cpp head/contrib/llvm/tools/lld/ELF/Config.h head/contrib/llvm/tools/lld/ELF/InputFiles.cpp
https://reviews.freebsd.org/D16528
Updated state for x86 and arm - bootstrap and system linker on amd64, arm64 - bootstrap linker on i386 - significant ports fallout on i386 due to -ztext default (relocation in read-only segment errors) - ready to be bootstrap linker on armv7 - effect of using lld as system linker for armv7 unknown - no change (not supported) for arm/armv6
armv5/armv6 should be addressed by: http://llvm.org/viewvc/llvm-project?rev=328846&view=rev https://reviews.llvm.org/D50076 https://reviews.llvm.org/D50077
A commit references this bug: Author: emaste Date: Wed Aug 1 19:17:56 UTC 2018 New revision: 337057 URL: https://svnweb.freebsd.org/changeset/base/337057 Log: Use lld as the bootstrap linker on armv7 by default As of r336972 lld is capable linking the armv7 kernel and userland, so enable it by default. PR: 229050 Reviewed by: kevans Tested by: kevans Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D16528 Changes: head/share/mk/src.opts.mk
A commit references this bug: Author: dim Date: Fri Oct 26 21:20:07 UTC 2018 New revision: 483054 URL: https://svnweb.freebsd.org/changeset/ports/483054 Log: Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60 This adds all the patches that were applied in the past to head, under contrib/llvm. After these, there only minimal diffs left between the port sources and the base sources. Most of these remaining diffs are due to #ifdef shortcuts in the base sources, because we don't compile certain features in. Other diffs are because the port has applied a few changes that we don't have in base. While here, use Makefile.LICENSE from the devel/llvm-devel port. Approved by: brooks (maintainer) Reviewed by: brooks PR: 212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355 MFH: 2018Q4 Differential Revision: https://reviews.freebsd.org/D17702 Changes: head/devel/llvm60/Makefile head/devel/llvm60/files/clang/patch-head-r331066.diff head/devel/llvm60/files/clang/patch-head-r336227.diff head/devel/llvm60/files/clang/patch-head-r338697.diff head/devel/llvm60/files/clang/patch-head-r339019.diff head/devel/llvm60/files/lld/ head/devel/llvm60/files/lld/patch-head-r331731.diff head/devel/llvm60/files/lld/patch-head-r333401.diff head/devel/llvm60/files/lld/patch-head-r336664.diff head/devel/llvm60/files/lld/patch-head-r336972.diff head/devel/llvm60/files/lld/patch-head-r337282.diff head/devel/llvm60/files/lld/patch-head-r338251.diff head/devel/llvm60/files/lld/patch-head-r338682.diff head/devel/llvm60/files/lld/patch-head-r339013.diff head/devel/llvm60/files/lld/patch-head-r339304.diff head/devel/llvm60/files/lldb/ head/devel/llvm60/files/lldb/patch-head-r332849.diff head/devel/llvm60/files/lldb/patch-head-r332965.diff head/devel/llvm60/files/patch-head-r308867.diff head/devel/llvm60/files/patch-head-r330686.diff head/devel/llvm60/files/patch-head-r331065.diff head/devel/llvm60/files/patch-head-r331366.diff head/devel/llvm60/files/patch-head-r336969.diff head/devel/llvm60/files/patch-head-r336970.diff head/devel/llvm60/files/patch-head-r337615.diff head/devel/llvm60/files/patch-head-r338689.diff
A commit references this bug: Author: dim Date: Wed Oct 31 18:49:08 UTC 2018 New revision: 483602 URL: https://svnweb.freebsd.org/changeset/ports/483602 Log: MFH: r481120 Update to a new snapshot. Update LICENSE data per mailing list feedback and move to a seperate Makefile.LICENSE for use by other llvm ports. MFH: r483054 Add all patches from base llvm/clang/lld/lldb 6.0 to devel/llvm60 This adds all the patches that were applied in the past to head, under contrib/llvm. After these, there only minimal diffs left between the port sources and the base sources. Most of these remaining diffs are due to #ifdef shortcuts in the base sources, because we don't compile certain features in. Other diffs are because the port has applied a few changes that we don't have in base. While here, use Makefile.LICENSE from the devel/llvm-devel port. Approved by: portmgr (miwi) Reviewed by: brooks PR: 212343, 225128, 225471, 226388, 226658, 226872, 229050, 230444, 230604, 231355 Differential Revision: https://reviews.freebsd.org/D17702 Changes: _U branches/2018Q4/ branches/2018Q4/devel/llvm-devel/Makefile branches/2018Q4/devel/llvm-devel/Makefile.LICENSE branches/2018Q4/devel/llvm-devel/Makefile.snapshot branches/2018Q4/devel/llvm-devel/distinfo branches/2018Q4/devel/llvm-devel/files/lldb-patch-tools_lldb_source_Plugins_Process_FreeBSD_ProcessFreeBSD.cpp branches/2018Q4/devel/llvm-devel/pkg-plist branches/2018Q4/devel/llvm60/Makefile branches/2018Q4/devel/llvm60/files/clang/patch-head-r331066.diff branches/2018Q4/devel/llvm60/files/clang/patch-head-r336227.diff branches/2018Q4/devel/llvm60/files/clang/patch-head-r338697.diff branches/2018Q4/devel/llvm60/files/clang/patch-head-r339019.diff branches/2018Q4/devel/llvm60/files/lld/ branches/2018Q4/devel/llvm60/files/lldb/ branches/2018Q4/devel/llvm60/files/patch-head-r308867.diff branches/2018Q4/devel/llvm60/files/patch-head-r330686.diff branches/2018Q4/devel/llvm60/files/patch-head-r331065.diff branches/2018Q4/devel/llvm60/files/patch-head-r331366.diff branches/2018Q4/devel/llvm60/files/patch-head-r336969.diff branches/2018Q4/devel/llvm60/files/patch-head-r336970.diff branches/2018Q4/devel/llvm60/files/patch-head-r337615.diff branches/2018Q4/devel/llvm60/files/patch-head-r338689.diff
Drop from 12.0 tracking; no more lld-related changes are going into 12.0.
See https://wiki.freebsd.org/powerpc/llvm-elfv2 for Clang + lld status on ppc/elfv2
i386 switched to lld as system linker in r343606
see-also llvm bugs 36009, 37735, 34501, 37257 are resolved tracking bug 23214 still open
Associated LLVM PRs are closed and all archs have migrated to lld as the linker.