devel/llvm/18 fails to build on mips64 because of too large GOT while
linking libLLVM.so. This can be fixed by compiling the code using
the extended GOT access pattern.

devel/llvm/19 and future versions probably result in large GOTs too,
so those might need the same fix. This is just my guessing, though.

OK?

Index: Makefile.inc
===================================================================
RCS file: ports/devel/llvm/Makefile.inc,v
diff -u -p -r1.20 Makefile.inc
--- Makefile.inc        21 Dec 2024 11:39:33 -0000      1.20
+++ Makefile.inc        21 Jan 2025 15:20:29 -0000
@@ -111,6 +111,13 @@ CXXFLAGS-i386 =            -fno-ret-protector -mno
 CXXFLAGS-mips64 =      -fno-ret-protector -fomit-frame-pointer
 CXXFLAGS-mips64el =    -fno-ret-protector -fomit-frame-pointer
 CXXFLAGS-powerpc =     -fno-ret-protector
+
+# Avoid GOT overflow.
+.if ${LLVM_MAJOR} > 17
+CXXFLAGS-mips64 +=     -mxgot
+CXXFLAGS-mips64el +=   -mxgot
+.endif
+
 CXXFLAGS +=            ${CXXFLAGS-${MACHINE_ARCH}}
 
 ALL_TARGET =           all docs-llvm-man docs-clang-man

Reply via email to