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?


Index: Makefile
===================================================================
RCS file: /d/cvs/ports/devel/llvm/Makefile,v
retrieving revision 1.130
diff -u -p -p -u -r1.130 Makefile
--- Makefile    8 Jan 2017 01:59:49 -0000       1.130
+++ Makefile    10 Feb 2017 03:20:10 -0000
@@ -68,8 +68,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