diff options
author | Chris Lattner <sabre@nondot.org> | 2009-07-09 04:24:46 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2009-07-09 04:24:46 +0000 |
commit | 88e1fd539e80827931694e667c119ef01c7d1184 (patch) | |
tree | 42f21f7884f027c400787189abaad5bb0db621d4 /lib/Target/X86/X86TargetMachine.cpp | |
parent | f16120475e77bcacf553373d5720d53132378572 (diff) | |
download | external_llvm-88e1fd539e80827931694e667c119ef01c7d1184.zip external_llvm-88e1fd539e80827931694e667c119ef01c7d1184.tar.gz external_llvm-88e1fd539e80827931694e667c119ef01c7d1184.tar.bz2 |
isPICStyleRIPRel() and friends are never true in -static mode.
Simplify code based on this.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@75099 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/X86/X86TargetMachine.cpp')
-rw-r--r-- | lib/Target/X86/X86TargetMachine.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Target/X86/X86TargetMachine.cpp b/lib/Target/X86/X86TargetMachine.cpp index 9448f30..eb0cf93 100644 --- a/lib/Target/X86/X86TargetMachine.cpp +++ b/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. |