aboutsummaryrefslogtreecommitdiff
path: root/lib/Target/PowerPC/PPCTargetMachine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--lib/Target/PowerPC/PPCTargetMachine.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
index a58926ff7e..9b5701b65e 100644
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -67,6 +67,11 @@ PPCTargetMachine::PPCTargetMachine(const Module &M, IntrinsicLowering *IL,
if (Subtarget.isAIX()) PPCTarget = TargetAIX;
if (Subtarget.isDarwin()) PPCTarget = TargetDarwin;
}
+ if (getRelocationModel() == Reloc::Default)
+ if (Subtarget.isDarwin())
+ setRelocationModel(Reloc::DynamicNoPIC);
+ else
+ setRelocationModel(Reloc::PIC);
}
/// addPassesToEmitFile - Add passes to the specified pass manager to implement
@@ -129,8 +134,8 @@ bool PPCTargetMachine::addPassesToEmitFile(PassManager &PM,
}
void PPCJITInfo::addPassesToJITCompile(FunctionPassManager &PM) {
- // The JIT does not support or need PIC.
- PICEnabled = false;
+ // The JIT should use static relocation model.
+ TM.setRelocationModel(Reloc::Static);
// Run loop strength reduction before anything else.
PM.add(createLoopStrengthReducePass());