Skip to content

Commit dc7076b

Browse files
committed
[LLVM-3.9] Pass correct relocation model flag
1 parent 2c92756 commit dc7076b

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

configure

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1020,6 +1020,11 @@ then
10201020
err "bad LLVM version: $LLVM_VERSION, need >=3.7"
10211021
;;
10221022
esac
1023+
1024+
if "$CFG_LLVM_ROOT/bin/llvm-mc" -help | grep "-relocation-model"; then
1025+
CFG_LLVM_MC_HAS_RELOCATION_MODEL=1
1026+
putvar CFG_LLVM_MC_HAS_RELOCATION_MODEL
1027+
fi
10231028
fi
10241029

10251030
# Even when the user overrides the choice of CC, still try to detect

mk/platform.mk

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,12 +221,19 @@ define CFG_MAKE_TOOLCHAIN
221221
LLVM_MC_RELOCATION_MODEL="default"
222222
endif
223223

224+
# LLVM changed this flag in 3.9
225+
ifdef CFG_LLVM_MC_HAS_RELOCATION_MODEL
226+
LLVM_MC_RELOC_FLAG := -relocation-model=$$(LLVM_MC_RELOCATION_MODEL)
227+
else
228+
LLVM_MC_RELOC_FLAG := -position-independent
229+
endif
230+
224231
# We're using llvm-mc as our assembler because it supports
225232
# .cfi pseudo-ops on mac
226233
CFG_ASSEMBLE_$(1)=$$(CPP_$(1)) -E $$(2) | \
227234
$$(LLVM_MC_$$(CFG_BUILD)) \
228235
-assemble \
229-
-relocation-model=$$(LLVM_MC_RELOCATION_MODEL) \
236+
$$(LLVM_MC_RELOC_FLAG) \
230237
-filetype=obj \
231238
-triple=$(1) \
232239
-o=$$(1)

0 commit comments

Comments
 (0)