From 4f78aa4725f0b3c2050d2527557f9f7620b01cc5 Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Mon, 16 Apr 2012 21:36:55 +0000 Subject: [PATCH] Work around an issue on 32-bit PowerPC, where clang executable can get too big, causing 'relocation truncated to fit' errors at link time. Reviewed by: nwhitehorn --- gnu/lib/csu/Makefile | 1 + lib/clang/clang.build.mk | 6 ++++++ lib/csu/powerpc/Makefile | 3 ++- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gnu/lib/csu/Makefile b/gnu/lib/csu/Makefile index 4999d06a578f..1c31a9876dac 100644 --- a/gnu/lib/csu/Makefile +++ b/gnu/lib/csu/Makefile @@ -34,6 +34,7 @@ CFLAGS+= -include osreldate.h .if ${MACHINE_CPUARCH} == "powerpc" TGTOBJS= crtsavres.o SRCS+= crtsavres.asm +CFLAGS+= -mlongcall .endif .if ${MACHINE_CPUARCH} == "sparc64" TGTOBJS= crtfastmath.o diff --git a/lib/clang/clang.build.mk b/lib/clang/clang.build.mk index a14918dc5e6a..7437a1df7b90 100644 --- a/lib/clang/clang.build.mk +++ b/lib/clang/clang.build.mk @@ -11,6 +11,12 @@ CFLAGS+=-I${LLVM_SRCS}/include -I${CLANG_SRCS}/include \ # LLVM is not strict aliasing safe as of 12/31/2011 CFLAGS+= -fno-strict-aliasing +# Work around an issue on 32-bit PowerPC, where the clang executable can get +# too big, causing 'relocation truncated to fit' errors at link time. +.if ${MACHINE_ARCH} == "powerpc" +CFLAGS+=-mlongcall +.endif + TARGET_ARCH?= ${MACHINE_ARCH} CFLAGS+=-DLLVM_DEFAULT_TARGET_TRIPLE=\"${TARGET_ARCH:C/amd64/x86_64/}-unknown-freebsd10.0\" diff --git a/lib/csu/powerpc/Makefile b/lib/csu/powerpc/Makefile index 1e1d1fa2d55a..a3e0cabbe321 100644 --- a/lib/csu/powerpc/Makefile +++ b/lib/csu/powerpc/Makefile @@ -6,7 +6,8 @@ SRCS= crt1.c crti.S crtn.S OBJS= ${SRCS:N*.h:R:S/$/.o/g} OBJS+= Scrt1.o gcrt1.o CFLAGS+= -I${.CURDIR}/../common \ - -I${.CURDIR}/../../libc/include + -I${.CURDIR}/../../libc/include \ + -mlongcall all: ${OBJS}