summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
diff options
context:
space:
mode:
authorEric Christopher <echristo@gmail.com>2017-06-17 02:25:56 +0000
committerEric Christopher <echristo@gmail.com>2017-06-17 02:25:56 +0000
commitc70d07b7ea6b1d7ce79726f453ac811ff7f3111b (patch)
tree8667776de8259920fafbe10490e9d12c9cc64962 /llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
parent5ec30ef4e495e2505cf4327fc4095b1e61139d11 (diff)
downloadbcm5719-llvm-c70d07b7ea6b1d7ce79726f453ac811ff7f3111b.tar.gz
bcm5719-llvm-c70d07b7ea6b1d7ce79726f453ac811ff7f3111b.zip
Rework logic and comment out the default relocation models for PPC.
llvm-svn: 305630
Diffstat (limited to 'llvm/lib/Target/PowerPC/PPCTargetMachine.cpp')
-rw-r--r--llvm/lib/Target/PowerPC/PPCTargetMachine.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
index d6bcd0ac3a3..fd8df8c2335 100644
--- a/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/llvm/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -192,16 +192,19 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
static Reloc::Model getEffectiveRelocModel(const Triple &TT,
Optional<Reloc::Model> RM) {
- if (!RM.hasValue()) {
- if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le) {
- if (!TT.isOSBinFormatMachO() && !TT.isMacOSX())
- return Reloc::PIC_;
- }
- if (TT.isOSDarwin())
- return Reloc::DynamicNoPIC;
- return Reloc::Static;
- }
- return *RM;
+ if (RM.hasValue())
+ return *RM;
+
+ // Darwin defaults to dynamic-no-pic.
+ if (TT.isOSDarwin())
+ return Reloc::DynamicNoPIC;
+
+ // Non-darwin 64-bit platforms are PIC by default.
+ if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le)
+ return Reloc::PIC_;
+
+ // 32-bit is static by default.
+ return Reloc::Static;
}
// The FeatureString here is a little subtle. We are modifying the feature
OpenPOWER on IntegriCloud