Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F133633704
D20261.id61158.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.id61158.diff
View Options
Index: Makefile.libcompat
===================================================================
--- Makefile.libcompat
+++ Makefile.libcompat
@@ -8,6 +8,11 @@
# -------------------------------------------------------------------
# 32 bit world
+
+
+# Determines linker used for 32-bit compatibility
+.include "Makefile.libcompat.inc1"
+
.if ${TARGET_ARCH} == "amd64"
.if empty(TARGET_CPUTYPE)
LIB32CPUFLAGS= -march=i686 -mmmx -msse -msse2
@@ -33,10 +38,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: Makefile.libcompat.inc1
===================================================================
--- /dev/null
+++ Makefile.libcompat.inc1
@@ -0,0 +1,40 @@
+# Determines linker used for 32-bit compatibility
+# Currently LLD support for PowerPC 32-bit is not complete,
+# so falling back to ld.bfd
+
+
+
+
+# native build
+_LIB32LD_NATIVE=/usr/bin/ld.bfd
+# cross
+_LIB32LD_CROSS=${WORLDTMP}/usr/bin/ld.bfd
+# cross with toolchain file
+_LIB32LD_CROSS_FILE=${LOCALBASE}/bin/${CROSS_BINUTILS_PREFIX}-ld.bfd
+
+
+.if ${_HOST_ARCH} == "powerpc64"
+LIB32LD= ${_LIB32LD_NATIVE}
+
+.elif defined(TARGET_ARCH) && "${LINKER_TYPE}" == "lld"
+.if ${TARGET_ARCH} == "powerpc64" && defined(CROSS_TOOLCHAIN)
+.if !defined(CROSS_BINUTILS_PREFIX)
+.error 32 bit binaries on PowerPC64 requires binutils linker ld.bfd. Please set CROSS_BINUTILS_PREFIX.
+.endif
+LIB32LD= ${_LIB32LD_CROSS_FILE}
+.else
+LIB32LD= ${_LIB32LD_CROSS}
+
+.endif
+.endif
+
+
+# for other unhandled cases (i.e. other platforms) just use the main linker
+
+# cross building
+.if defined(XLD)
+LIB32LD?=${XLD}
+.else
+LIB32LD?=${LD}
+.endif
+
Index: stand/Makefile.inc
===================================================================
--- stand/Makefile.inc
+++ stand/Makefile.inc
@@ -1,3 +1,4 @@
# $FreeBSD$
.include "defs.mk"
+.include "${SRCTOP}/Makefile.libcompat.inc1"
Index: stand/defs.mk
===================================================================
--- stand/defs.mk
+++ stand/defs.mk
@@ -34,6 +34,7 @@
UBOOTSRC= ${BOOTSRC}/uboot
ZFSSRC= ${SASRC}/zfs
LIBCSRC= ${SRCTOP}/lib/libc
+WORLDTMP= ${OBJTOP}/tmp
BOOTOBJ= ${OBJTOP}/stand
@@ -94,6 +95,10 @@
# or powerpc64.
.if ${MACHINE_ARCH} == "powerpc64"
CFLAGS+= -m32 -mcpu=powerpc
+# Use same linker used to link 32 bit binaries
+.if "${COMPILER_TYPE}" == "clang" && "${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
Tue, Oct 28, 4:16 AM (12 h, 36 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
24336574
Default Alt Text
D20261.id61158.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