diff options
author | Justin Hibbits <jhibbits@FreeBSD.org> | 2019-12-24 16:03:33 +0000 |
---|---|---|
committer | Justin Hibbits <jhibbits@FreeBSD.org> | 2019-12-24 16:03:33 +0000 |
commit | b451cd45449385ac7c5b8d8b809f80109e60e3ff (patch) | |
tree | 9d0abd73a31c672a2ad068f28c4441007082deb8 /share | |
parent | 7821a820d008a254bbe53b96f413c2ecab5af964 (diff) | |
download | src-b451cd45449385ac7c5b8d8b809f80109e60e3ff.tar.gz src-b451cd45449385ac7c5b8d8b809f80109e60e3ff.zip |
[PowerPC64] Use ld.bfd to build LIB32 and STAND - when using llvm
Summary:
This patch is to support ongoing work for replacing "GCC/BFD" by "CLANG/LLD" on
target PowerPC64 [1], by proposing a way to specify and/or locate a secondary
ld.bfd linker.
This is necessary as LLD currently doesn't support PowerPC 32 bits, so we keep
using BFD for the 32 bit stuff on PowePC64(LIB32 compatibility and
STAND/slof/loader.)
- creates LD_BFD variable pointing to ld.bfd
- use LD_BFD as linker for LIB32/compat
- Default behavior for other platforms aren't changed.
[1] https://wiki.freebsd.org/powerpc/llvm-elfv2
Submitted by: alfredo.junior_eldorado.org.br
Reviewed by: imp
Differential Revision: https://reviews.freebsd.org/D20261
Notes
Notes:
svn path=/head/; revision=356054
Diffstat (limited to 'share')
-rw-r--r-- | share/mk/bsd.compat.mk | 11 | ||||
-rw-r--r-- | share/mk/bsd.cpu.mk | 14 |
2 files changed, 24 insertions, 1 deletions
diff --git a/share/mk/bsd.compat.mk b/share/mk/bsd.compat.mk index 73b236bc6666..2209829e8e1f 100644 --- a/share/mk/bsd.compat.mk +++ b/share/mk/bsd.compat.mk @@ -47,11 +47,20 @@ LIB32CPUFLAGS= -mcpu=powerpc .else LIB32CPUFLAGS= -mcpu=${COMPAT_CPUTYPE} .endif + +.if ${COMPAT_COMPILER_TYPE} == "gcc" 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="${XLD} -m elf32ppc_fbsd" + LD="${LD_BFD} -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 c5536222ac8a..31eb9e3510de 100644 --- a/share/mk/bsd.cpu.mk +++ b/share/mk/bsd.cpu.mk @@ -412,3 +412,17 @@ CFLAGS_NO_SIMD += ${CFLAGS_NO_SIMD.${COMPILER_TYPE}} # These come from make.conf or the command line or the environment. 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 + |