Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F109025382
D20261.id59710.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D20261.id59710.diff
View Options
Index: Makefile.inc1
===================================================================
--- Makefile.inc1
+++ Makefile.inc1
@@ -802,6 +802,7 @@
${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
LIBCOMPAT= 32
.include "Makefile.libcompat"
+CROSSENV+=LIB32LD=${LIB32LD}
.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
LIBCOMPAT= SOFT
.include "Makefile.libcompat"
Index: Makefile.libcompat
===================================================================
--- Makefile.libcompat
+++ Makefile.libcompat
@@ -8,6 +8,36 @@
# -------------------------------------------------------------------
# 32 bit world
+
+
+# Determines linker used for 32-bit compatibility
+# Currently LLD support for PowerPC 32-bit is not complete,
+# so falling back to ld.bfd
+.if ${TARGET_ARCH} == "powerpc64" && "${LINKER_TYPE}" == "lld"
+
+# cross build with toolchain file and NOT defined binutils prefix
+.if ("${HOST_ARCH}" != "${TARGET_ARCH}") && defined(CROSS_TOOLCHAIN) && !defined(CROSS_BINUTILS_PREFIX)
+.info 32 bit binaries on PowerPC64 requires binutils linker ld.bfd. Please set CROSS_BINUTILS_PREFIX.
+
+# cross build with toolchain file and defined binutils prefix
+.elif ("${HOST_ARCH}" != "${TARGET_ARCH}") && defined(CROSS_TOOLCHAIN) && defined(CROSS_BINUTILS_PREFIX)
+LIB32LD?=${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd
+
+# cross build without using toolchain file (using builtin cross toolchain)
+.elif ("${HOST_ARCH}" != "${TARGET_ARCH}")
+LIB32LD?=${WORLDTMP}/usr/bin/ld.bfd
+
+.else # Native build
+LIB32LD?=ld.bfd
+.endif
+
+.info LIB32: using ${LIB32LD} as linker for LIB32
+.endif
+
+# for other platforms (or when LIB32LD is not set), just use the main linker
+LIB32LD?=${XLD}
+
+
.if ${TARGET_ARCH} == "amd64"
.if empty(TARGET_CPUTYPE)
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
@@ -33,10 +63,24 @@
.else
LIB32CPUFLAGS= -mcpu=${TARGET_CPUTYPE}
.endif
+
+.if ${WANT_COMPILER_TYPE} == gcc || \
+ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc)
LIB32CPUFLAGS+= -m32
+.else
+LIB32CPUFLAGS+= -target powerpc-unknown-freebsd13.0
+
+.if ${LIB32LD} == "ld.bfd"
+LIB32CPUFLAGS+= -fuse-ld=bfd
+.else
+LIB32CPUFLAGS+= -fuse-ld=${LIB32LD}
+.endif
+
+.endif
+
LIB32WMAKEENV= MACHINE=powerpc MACHINE_ARCH=powerpc
LIB32WMAKEFLAGS= \
- LD="${XLD} -m elf32ppc_fbsd" \
+ LD="${LIB32LD} -m elf32ppc_fbsd" \
OBJCOPY="${XOBJCOPY}"
.elif ${TARGET_ARCH:Mmips64*} != ""
Index: stand/defs.mk
===================================================================
--- stand/defs.mk
+++ stand/defs.mk
@@ -93,6 +93,10 @@
# or powerpc64.
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
+# Use same linker used to link 32 bit binaries
+.if "${LINKER_TYPE}" == "lld"
+CFLAGS+= -fuse-ld=${LIB32LD}
+.endif
.endif
# For amd64, there's a bit of mixed bag. Some of the tree (i386, lib*32) is
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 31, 7:17 PM (18 h, 50 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
16369221
Default Alt Text
D20261.id59710.diff (2 KB)
Attached To
Mode
D20261: [PowerPC64] Use ld.bfd to build LIB32 and STAND - when using llvm
Attached
Detach File
Event Timeline
Log In to Comment