summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetMachine.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-07-09 04:24:46 +0000
committerChris Lattner <sabre@nondot.org>2009-07-09 04:24:46 +0000
commit3945dd0c44d5b8031279084d990668756f9afbb9 (patch)
tree7e4462ce73da62d59f21d2b5070395d67093816d /llvm/lib/Target/X86/X86TargetMachine.cpp
parent4e705e421cd84413359eb7dd21df6990ec133c75 (diff)
downloadbcm5719-llvm-3945dd0c44d5b8031279084d990668756f9afbb9.tar.gz
bcm5719-llvm-3945dd0c44d5b8031279084d990668756f9afbb9.zip
isPICStyleRIPRel() and friends are never true in -static mode.
Simplify code based on this. llvm-svn: 75099
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetMachine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/llvm/lib/Target/X86/X86TargetMachine.cpp b/llvm/lib/Target/X86/X86TargetMachine.cpp
index 9448f30878e..eb0cf93562e 100644
--- a/llvm/lib/Target/X86/X86TargetMachine.cpp
+++ b/llvm/lib/Target/X86/X86TargetMachine.cpp
@@ -158,11 +158,14 @@ X86TargetMachine::X86TargetMachine(const Module &M, const std::string &FS,
// ELF and X86-64 don't have a distinct DynamicNoPIC model. DynamicNoPIC
// is defined as a model for code which may be used in static or dynamic
- // executables but not necessarily a shared library. On these systems we just
- // compile in -static mode.
- if (getRelocationModel() == Reloc::DynamicNoPIC &&
- !Subtarget.isTargetDarwin())
- setRelocationModel(Reloc::Static);
+ // executables but not necessarily a shared library. On X86-32 we just
+ // compile in -static mode, in x86-64 we use PIC.
+ if (getRelocationModel() == Reloc::DynamicNoPIC) {
+ if (is64Bit)
+ setRelocationModel(Reloc::PIC_);
+ else if (!Subtarget.isTargetDarwin())
+ setRelocationModel(Reloc::Static);
+ }
// If we are on Darwin, disallow static relocation model in X86-64 mode, since
// the Mach-O file format doesn't support it.
OpenPOWER on IntegriCloud