From 3e62fdd5fa5c779fe46a2c4e415f4ce979cf35cc Mon Sep 17 00:00:00 2001 From: jca Date: Thu, 16 Feb 2017 15:07:16 +0000 Subject: [PATCH] Use -mlong-calls on arm and powerpc to work around relocations overflow On those architectures the .text section of the executables is too big for the 32M immediate branch offset. ld --relax is supposed to fix things on powerpc, but it is actually ineffective here. cc -mlong-calls creates branches instructions using a full 32 bits register; FreeBSD uses the same workaround. A fix for lib/csu is still needed to avoid an overflow between .init and .fini sections. powerpc hasn't been tested, but we know that devel/llvm is already broken there anyway. ok Brad (maintainer) --- devel/llvm/Makefile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/devel/llvm/Makefile b/devel/llvm/Makefile index a70910f7518..5f86f6ef8a5 100644 --- a/devel/llvm/Makefile +++ b/devel/llvm/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.132 2017/02/12 11:25:19 ajacoutot Exp $ +# $OpenBSD: Makefile,v 1.133 2017/02/16 15:07:16 jca Exp $ # XXX: Remember to bump MODCLANG_VERSION in lang/clang/clang.port.mk when # updating this port. @@ -66,8 +66,13 @@ CONFIGURE_ARGS = -DLLVM_ENABLE_FFI:Bool=False \ # Have the build disable PIE to workaround breakage that was # introduced when PIE was enabled .if ${MACHINE_ARCH} == "powerpc" -CONFIGURE_ARGS += -DCMAKE_EXE_LINKER_FLAGS="-Wl,--relax -nopie" -CONFIGURE_ARGS += -DCMAKE_SHARED_LINKER_FLAGS="-Wl,--relax -nopie" +CFLAGS += -mlongcall +CXXFLAGS += -mlongcall +CONFIGURE_ARGS += -DCMAKE_EXE_LINKER_FLAGS="-nopie" +CONFIGURE_ARGS += -DCMAKE_SHARED_LINKER_FLAGS="-nopie" +.elif ${MACHINE_ARCH} == "arm" +CFLAGS += -mlong-calls +CXXFLAGS += -mlong-calls .endif TEST_TARGET = check