aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Bergren <bdragon@FreeBSD.org>2020-03-27 01:00:03 +0000
committerBrandon Bergren <bdragon@FreeBSD.org>2020-03-27 01:00:03 +0000
commita04ec978b369e3a2651b050fff8b11aaf0a9dcd7 (patch)
treeba568af3fd9f4f37191df503e7d4ca9d321e49c5
parent3ee58df503b601febeef11f23c4a7e2adf425b96 (diff)
downloadsrc-a04ec978b369.tar.gz
src-a04ec978b369.zip
[PowerPC] Switch powerpc and powerpcspe to lld
Now that LLD 10 is out, and required patches have landed, we are now ready to finally switch away from the ancient in-tree ld.bfd. Special thanks to Fangrui Song for many hours of work on getting the 32-bit powerpc lld ready for prime-time. Reviewed by: emaste (earlier revision), jhibbits Relnotes: yes Differential Revision: https://reviews.freebsd.org/D24111
Notes
Notes: svn path=/head/; revision=359347
-rw-r--r--gnu/usr.bin/binutils/Makefile6
-rw-r--r--share/man/man7/arch.74
-rw-r--r--share/mk/bsd.compat.mk6
-rw-r--r--share/mk/bsd.cpu.mk13
-rw-r--r--share/mk/src.opts.mk9
-rw-r--r--stand/defs.mk4
-rw-r--r--tools/build/mk/OptionalObsoleteFiles.inc5
-rw-r--r--tools/build/options/WITHOUT_BINUTILS3
-rw-r--r--tools/build/options/WITH_BINUTILS5
9 files changed, 10 insertions, 45 deletions
diff --git a/gnu/usr.bin/binutils/Makefile b/gnu/usr.bin/binutils/Makefile
index 7363a6f13924..b434cee39cf3 100644
--- a/gnu/usr.bin/binutils/Makefile
+++ b/gnu/usr.bin/binutils/Makefile
@@ -17,12 +17,6 @@ SUBDIR.${MK_BINUTILS}+= objdump
SUBDIR.${MK_BINUTILS}+= as
.endif
-# All archs except powerpc either use lld or require external toolchain.
-# powerpc still needs binutils ld to link 32-bit binaries.
-.if ${TARGET} == "powerpc"
-SUBDIR.${MK_BINUTILS}+=ld
-.endif
-
SUBDIR_DEPEND_libbinutils=libbfd # for bfdver.h
SUBDIR_DEPEND_as=libbfd libiberty libopcodes
SUBDIR_DEPEND_ld=libbfd libiberty
diff --git a/share/man/man7/arch.7 b/share/man/man7/arch.7
index c6aaffff8e66..5c21449ff44d 100644
--- a/share/man/man7/arch.7
+++ b/share/man/man7/arch.7
@@ -311,8 +311,8 @@ This table shows the default tool chain for each architecture.
.It mips64el Ta Clang Ta lld
.It mips64elhf Ta Clang Ta lld
.It mips64hf Ta Clang Ta lld
-.It powerpc Ta Clang Ta GNU ld 2.17.50
-.It powerpcspe Ta Clang Ta GNU ld 2.17.50
+.It powerpc Ta Clang Ta lld
+.It powerpcspe Ta Clang Ta lld
.It powerpc64 Ta Clang Ta lld
.It riscv64 Ta Clang Ta lld
.It riscv64sf Ta Clang Ta lld
diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk
index d5b096032470..53f086428588 100644
--- a/share/mk/bsd.compat.mk
+++ b/share/mk/bsd.compat.mk
@@ -52,15 +52,11 @@ LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE}
LIB32CPUFLAGS+= -m32
.else
LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0
-
-# Use BFD to workaround ld.lld issues on PowerPC 32 bit
-LIB32CPUFLAGS+= -fuse-ld=${LD_BFD}
.endif
LIB32_MACHINE= powerpc
LIB32_MACHINE_ARCH= powerpc
-LIB32WMAKEFLAGS= \
- LD="${LD_BFD} -m elf32ppc_fbsd"
+LIB32WMAKEFLAGS= -m elf32ppc_fbsd
.elif ${COMPAT_ARCH:Mmips64*} != ""
HAS_COMPAT=32
diff --git a/share/mk/bsd.cpu.mk b/share/mk/bsd.cpu.mk
index e5ac548c238a..b22e81ecc26a 100644
--- a/share/mk/bsd.cpu.mk
+++ b/share/mk/bsd.cpu.mk
@@ -388,16 +388,3 @@ CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}}
CFLAGS += ${CFLAGS.${MACHINE_ARCH}}
CXXFLAGS += ${CXXFLAGS.${MACHINE_ARCH}}
-
-# Defines a variable for Binutils linker, to be used to workaround some
-# issue with LLVM LLD (i.e. support for PowerPC32 bit on PowerPC64)
-#
-# This is an unavoidable cross coupling with Makefile.inc1 and
-# normal builds works when CROSS_BINUTILS_PREFIX and could be removed
-# when LLD PowerPC 32 bit support is completed
-.if defined(CROSS_BINUTILS_PREFIX)
-LD_BFD=${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd
-.else
-LD_BFD=${OBJTOP}/tmp/usr/bin/ld.bfd
-.endif
-
diff --git a/share/mk/src.opts.mk b/share/mk/src.opts.mk
index 54730e4beff8..0c836c72b72c 100644
--- a/share/mk/src.opts.mk
+++ b/share/mk/src.opts.mk
@@ -131,6 +131,8 @@ __DEFAULT_YES_OPTIONS = \
LIBPTHREAD \
LIBTHR \
LLD \
+ LLD_BOOTSTRAP \
+ LLD_IS_LD \
LLVM_COV \
LLVM_TARGET_ALL \
LOADER_GELI \
@@ -289,7 +291,7 @@ __DEFAULT_NO_OPTIONS+=LLVM_TARGET_BPF
.if ${__T} == "aarch64" || ${__T:Mriscv*} != ""
BROKEN_OPTIONS+=BINUTILS BINUTILS_BOOTSTRAP GDB
.endif
-.if ${__T} == "amd64" || ${__T} == "i386" || ${__T:Mpowerpc*}
+.if ${__T} == "amd64" || ${__T} == "i386"
__DEFAULT_YES_OPTIONS+=BINUTILS_BOOTSTRAP
.else
__DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
@@ -297,11 +299,6 @@ __DEFAULT_NO_OPTIONS+=BINUTILS_BOOTSTRAP
.if ${__T:Mriscv*} != ""
BROKEN_OPTIONS+=OFED
.endif
-.if ${__T} != "powerpc" && ${__T} != "powerpcspe"
-__DEFAULT_YES_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
-.else
-__DEFAULT_NO_OPTIONS+=LLD_BOOTSTRAP LLD_IS_LD
-.endif
.if ${__T} == "aarch64" || ${__T} == "amd64" || ${__T} == "i386"
__DEFAULT_YES_OPTIONS+=LLDB
.else
diff --git a/stand/defs.mk b/stand/defs.mk
index 06be83553a6c..8d41c5f6f1b2 100644
--- a/stand/defs.mk
+++ b/stand/defs.mk
@@ -100,10 +100,6 @@ CFLAGS+= -DLOADER_DISK_SUPPORT
# or powerpc64.
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
-# Use ld.bfd to workaround ld.lld issues on PowerPC 32 bit
-.if "${COMPILER_TYPE}" == "clang" && "${LINKER_TYPE}" == "lld"
-CFLAGS+= -fuse-ld=${LD_BFD}
-.endif
.endif
# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
diff --git a/tools/build/mk/OptionalObsoleteFiles.inc b/tools/build/mk/OptionalObsoleteFiles.inc
index 6ed0b04df404..9f02de5396e9 100644
--- a/tools/build/mk/OptionalObsoleteFiles.inc
+++ b/tools/build/mk/OptionalObsoleteFiles.inc
@@ -413,12 +413,9 @@ OLD_FILES+=usr/share/man/man7/ldint.7.gz
OLD_FILES+=usr/share/man/man7/binutils.7.gz
.endif
.endif
-# powerpc64 still needs ld.bfd for 32-bit binaries/libraries
-.if !defined(WITH_PORT_BASE_BINUTILS) && ${TARGET_ARCH} != "powerpc64"
-.if ${MK_BINUTILS} == no || ${MK_LLD_IS_LD} == yes
+.if !defined(WITH_PORT_BASE_BINUTILS)
OLD_FILES+=usr/bin/ld.bfd
.endif
-.endif
.if ${MK_BLACKLIST} == no
OLD_FILES+=etc/blacklistd.conf
diff --git a/tools/build/options/WITHOUT_BINUTILS b/tools/build/options/WITHOUT_BINUTILS
index 8d8d1ce4bccd..de85c02370bd 100644
--- a/tools/build/options/WITHOUT_BINUTILS
+++ b/tools/build/options/WITHOUT_BINUTILS
@@ -1,7 +1,6 @@
.\" $FreeBSD$
Do not build or install GNU
-.Xr as 1 ,
-.Xr ld.bfd 1 , and
+.Xr as 1 and
.Xr objdump 1
as part
of the normal system build.
diff --git a/tools/build/options/WITH_BINUTILS b/tools/build/options/WITH_BINUTILS
index 92a6122b912c..49b7ca594f37 100644
--- a/tools/build/options/WITH_BINUTILS
+++ b/tools/build/options/WITH_BINUTILS
@@ -2,7 +2,6 @@
Build and install GNU
.Xr as 1
on i386 and amd64,
-.Xr objdump 1 ,
and
-.Xr ld.bfd 1
-on powerpc as part of the normal system build.
+.Xr objdump 1
+as part of the normal system build.