summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-09 03:15:51 +0000
committerChris Lattner <sabre@nondot.org>2009-07-09 03:15:51 +0000
commit1c5bf9d26dda6aff271f5998f3b8e4dcb90d29c3 (patch)
treecf1229d4b2c7863c4d0ccd11d112e6a0d93fe98c /llvm/lib/Target/X86/X86TargetMachine.cpp
parent384a738b4a585f9a3501b3a595bd4c3a9f79de57 (diff)
downloadbcm5719-llvm-1c5bf9d26dda6aff271f5998f3b8e4dcb90d29c3.tar.gz
bcm5719-llvm-1c5bf9d26dda6aff271f5998f3b8e4dcb90d29c3.zip
When in -static mode, force the PIC style to none. Doing this requires fixing
code which conflated RIPRel PIC with x86-64. Fix these to just check for X86-64 directly. llvm-svn: 75092
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 5cf18a02ebd..1909986165a 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -147,6 +147,9 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
setRelocationModel(Reloc::Static);
}
+ assert(getRelocationModel() != Reloc::Default &&
+ "Relocation mode not picked");
+
// ELF doesn't have a distinct dynamic-no-PIC model. Dynamic-no-PIC
// is defined as a model for code which may be used in static or
// dynamic executables but not necessarily a shared library. On ELF
@@ -164,9 +167,9 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
setCodeModel(CodeModel::Small);
}
- if (Subtarget.isTargetCygMing())
- Subtarget.setPICStyle(PICStyles::WinPIC);
- else if (Subtarget.isTargetDarwin()) {
+ if (Subtarget.isTargetCygMing()) {
+ Subtarget.setPICStyle(PICStyles::None);
+ } else if (Subtarget.isTargetDarwin()) {
if (Subtarget.is64Bit())
Subtarget.setPICStyle(PICStyles::RIPRel);
else
@@ -177,6 +180,11 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
else
Subtarget.setPICStyle(PICStyles::GOT);
}
+
+ // Finally, unless we're in PIC or DynamicNoPIC mode, set the PIC style to
+ // None.
+ if (getRelocationModel() == Reloc::Static)
+ Subtarget.setPICStyle(PICStyles::None);
}
//===----------------------------------------------------------------------===//
OpenPOWER on IntegriCloud