[alpine-aports] [PATCH] main/llvm5: fix build on mips*

alpine-mips-patches
Details
Message ID
<20180915222226.55FF42E062@mx7.valuehost.ru>
Sender timestamp
1537050146
DKIM signature
missing
Download raw message
Patch: +11 -0
This enables native build on mips* however some tests fail:
1) ExecutionEngine/frem.ll - fails because O32+FP64+nan2008 binary
(lli) tries to JIT-run O32 FP32 code which uses double floats.
Irrelevant for the actual alpine mips* definition though (soft float).

2) A bunch of X86+gold tests - for unknown reason.
LLVM_TARGETS_TO_BUILD should be limited to just
"AMDGPU;NVPTX;Mips;BPF" anyway.

---
 main/llvm5/APKBUILD | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/main/llvm5/APKBUILD b/main/llvm5/APKBUILD
index 24bf82a342..68c0bf6892 100644
--- a/main/llvm5/APKBUILD
+++ b/main/llvm5/APKBUILD
@@ -32,6 +32,11 @@ case "$CARCH" in
 	arm*) options="$options !check";;
 esac
 
+# ld 2.31.1 aborts at bfd/merge.c:912
+case "$CARCH" in
+	mips*) makedepends="$makedepends binutils-gold";;
+esac
+
 # Whether is this package the default (latest) LLVM version.
 _default_llvm="yes"
 
@@ -76,6 +81,11 @@ build() {
 	# Auto-detect it by guessing either.
 	local ffi_include_dir="$(pkg-config --cflags-only-I libffi | sed 's|^-I||g')"
 
+	case "$CARCH" in
+	mips*) _llvm_use_linker="-DLLVM_USE_LINKER=gold";;
+	*) _llvm_use_linker="";;
+	esac
+
 	cmake -Wno-dev \
 		-DCMAKE_BUILD_TYPE=MinSizeRel \
 		-DCMAKE_C_FLAGS_MINSIZEREL_INIT="$CFLAGS" \
@@ -105,6 +115,7 @@ build() {
 		-DLLVM_LINK_LLVM_DYLIB=ON \
 		-DLLVM_TARGETS_TO_BUILD='X86;ARM;AArch64;PowerPC;SystemZ;AMDGPU;NVPTX;Mips;BPF' \
 		-DLLVM_APPEND_VC_REV=OFF \
+		$_llvm_use_linker \
 		"$builddir"
 
 	make llvm-tblgen
-- 
2.19.0




---
Unsubscribe:  alpine-aports+unsubscribe@lists.alpinelinux.org
Help:         alpine-aports+help@lists.alpinelinux.org
---