From ab9c383d27949da127e8dc684400325280c18dca Mon Sep 17 00:00:00 2001 From: jhb Date: Tue, 4 Aug 2020 18:23:32 +0000 Subject: [PATCH] ld.bfd requires an explicit emulation for MIPS for ld -r. Unlike lld, ld.bfd doesn't infer the emulation from the first object file, but assumes its compiled in default for ld -r. Differential Revision: https://reviews.freebsd.org/D25728 --- lib/csu/mips/Makefile | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/lib/csu/mips/Makefile b/lib/csu/mips/Makefile index a0c6cdf0be53..372f98d5b18e 100644 --- a/lib/csu/mips/Makefile +++ b/lib/csu/mips/Makefile @@ -2,6 +2,27 @@ .PATH: ${.CURDIR:H}/common +.include + CFLAGS+= -DCRT_IRELOC_SUPPRESS +.if ${MACHINE_ARCH:Mmips64} +ELFCLASS= 64 +.else +ELFCLASS= 32 +.endif +.if ${MACHINE_ARCH:Mmips*el} +ENDIAN= l +.else +ENDIAN= b +.endif +.if ${MACHINE_ARCH:Mmipsn32*} +SUFFIX= n32 +.else +SUFFIX= +.endif + +# binutils requires an explicit emulation for ld -r +LDFLAGS.bfd+= -Wl,-m -Wl,elf${ELFCLASS}${ENDIAN}tsmip${SUFFIX}_fbsd + .include