Index: Makefile.inc1
===================================================================
--- Makefile.inc1
+++ Makefile.inc1
@@ -795,6 +795,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,12 @@
 
 # -------------------------------------------------------------------
 # 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
@@ -24,7 +30,7 @@
 		MACHINE_CPU="i686 mmx sse sse2"
 LIB32WMAKEFLAGS=	\
 		AS="${XAS} --32" \
-		LD="${XLD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" \
+		LD="${LIB32LD} -m elf_i386_fbsd -L${LIBCOMPATTMP}/usr/lib32" \
 		OBJCOPY="${XOBJCOPY}"
 
 .elif ${TARGET_ARCH} == "powerpc64"
@@ -33,10 +39,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*} != ""
@@ -57,9 +77,9 @@
 LIB32CPUFLAGS+= -mabi=32
 LIB32WMAKEENV=	MACHINE=mips MACHINE_ARCH=mips
 .if ${TARGET_ARCH:Mmips64el*} != ""
-LIB32WMAKEFLAGS= LD="${XLD} -m elf32ltsmip_fbsd"
+LIB32WMAKEFLAGS= LD="${LIB32LD} -m elf32ltsmip_fbsd"
 .else
-LIB32WMAKEFLAGS= LD="${XLD} -m elf32btsmip_fbsd"
+LIB32WMAKEFLAGS= LD="${LIB32LD} -m elf32btsmip_fbsd"
 .endif
 LIB32WMAKEFLAGS+= OBJCOPY="${XOBJCOPY}"
 .endif
Index: Makefile.libcompat.inc1
===================================================================
--- /dev/null
+++ Makefile.libcompat.inc1
@@ -0,0 +1,29 @@
+#
+# $FreeBSD$
+#
+
+# Currently LLD support for PowerPC 32-bit is not complete,
+# so falling back to ld.bfd
+.if ${TARGET_ARCH} == "powerpc64" &&  "${X_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}
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 "${X_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