[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
This commit is contained in:
Brandon Bergren 2020-03-27 01:00:03 +00:00
parent 3ee58df503
commit a04ec978b3
9 changed files with 10 additions and 45 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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.

View File

@ -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.