Jeremie Courreges-Anglas <[email protected]> writes:

> So clang fails to build on armv7:
>
>   http://build-failures.rhaalovely.net/arm/2017-01-05/devel/llvm.log
>
> The issue is that immediate addressing of the branch instruction can
> only access a 32MB range around the program counter.  clang is above
> that limit, resulting in relocation overflow.  Also the .init/.fini
> sections are too far apart.  The problem is similar on powerpc, where
> ld --relax seems ineffective:
>
>   http://build-failures.rhaalovely.net//powerpc/2017-01-18/devel/llvm.log
>
> With a pending csu diff by guenther@ and a bump of MAXTSIZ, the diff
> below gives us an llvm package for armv7.  As pointed out by jsg@,
> FreeBSD also uses -mlong-calls for arm:
>
>   https://reviews.freebsd.org/D4855
>
> It is hoped that this diff will also help powerpc, but no tests have
> been performed afaik.
>
> ok?

I missed the "recent" llvm update, here's a newer diff (still building).


Index: Makefile
===================================================================
RCS file: /d/cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.132
diff -u -p -r1.132 Makefile
--- Makefile    12 Feb 2017 11:25:19 -0000      1.132
+++ Makefile    14 Feb 2017 06:46:20 -0000
@@ -66,8 +66,13 @@ CONFIGURE_ARGS =     -DLLVM_ENABLE_FFI:Bool=
 # 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


-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE

Reply via email to