ARM JIT should observe -relocation-model command line option.
authorEvan Cheng <evan.cheng@apple.com>
Thu, 30 Oct 2008 16:10:54 +0000 (16:10 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Thu, 30 Oct 2008 16:10:54 +0000 (16:10 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@58433 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/ARMTargetMachine.cpp
lib/Target/ARM/ARMTargetMachine.h

index a96e25f22e7ca733d68a12c86fcb0c60c523049f..4ffd7798112264e9c06d0b8ef752c41989367100 100644 (file)
@@ -85,7 +85,9 @@ ARMTargetMachine::ARMTargetMachine(const Module &M, const std::string &FS,
     InstrInfo(Subtarget),
     FrameInfo(Subtarget),
     JITInfo(*this),
-    TLInfo(*this) {}
+    TLInfo(*this) {
+  DefRelocModel = getRelocationModel();
+}
 
 unsigned ARMTargetMachine::getJITMatchQuality() {
 #if defined(__arm__)
@@ -157,7 +159,8 @@ bool ARMTargetMachine::addAssemblyEmitter(PassManagerBase &PM, bool Fast,
 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));
index 35f97e3bc8853caf8ce7d2aab5b2222587628a50..6fe9a222b4df9d93a1f48ad1bb0940f916308cd8 100644 (file)
@@ -34,6 +34,7 @@ class ARMTargetMachine : public LLVMTargetMachine {
   ARMFrameInfo      FrameInfo;
   ARMJITInfo        JITInfo;
   ARMTargetLowering TLInfo;
+  Reloc::Model      DefRelocModel;    // Reloc model before it's overridden.
 
 protected:
   // To avoid having target depend on the asmprinter stuff libraries, asmprinter