ARM JIT should observe -relocation-model command line option.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58433 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Target/ARM/ARMTargetMachine.cpp b/lib/Target/ARM/ARMTargetMachine.cpp
index a96e25f..4ffd779 100644
--- a/lib/Target/ARM/ARMTargetMachine.cpp
+++ b/lib/Target/ARM/ARMTargetMachine.cpp
@@ -85,7 +85,9 @@
InstrInfo(Subtarget),
FrameInfo(Subtarget),
JITInfo(*this),
- TLInfo(*this) {}
+ TLInfo(*this) {
+ DefRelocModel = getRelocationModel();
+}
unsigned ARMTargetMachine::getJITMatchQuality() {
#if defined(__arm__)
@@ -157,7 +159,8 @@
bool ARMTargetMachine::addCodeEmitter(PassManagerBase &PM, bool Fast,
bool DumpAsm, MachineCodeEmitter &MCE) {
// FIXME: Move this to TargetJITInfo!
- setRelocationModel(Reloc::Static);
+ if (DefRelocModel == Reloc::Default)
+ setRelocationModel(Reloc::Static);
// Machine code emitter pass for ARM.
PM.add(createARMCodeEmitterPass(*this, MCE));