Position Independent Code (PIC) support [2]
[oota-llvm.git] / lib / Target / Mips / MipsTargetMachine.cpp
index 372e267d4629f99ddb20dba7183cf0434623a83d..64516594f66947c2fbe9193a1157961a547cf29b 100644 (file)
@@ -39,7 +39,11 @@ MipsTargetMachine::
 MipsTargetMachine(const Module &M, const std::string &FS): 
   Subtarget(*this, M, FS), DataLayout("E-p:32:32:32"), 
   InstrInfo(*this), FrameInfo(TargetFrameInfo::StackGrowsUp, 8, 0),
-  TLInfo(*this) {}
+  TLInfo(*this) 
+{
+  if (getRelocationModel() != Reloc::Static)
+    setRelocationModel(Reloc::PIC_);  
+}
 
 // return 0 and must specify -march to gen MIPS code.
 unsigned MipsTargetMachine::