]> granicus.if.org Git - llvm/commitdiff
Rework logic and comment out the default relocation models for PPC.
authorEric Christopher <echristo@gmail.com>
Sat, 17 Jun 2017 02:25:56 +0000 (02:25 +0000)
committerEric Christopher <echristo@gmail.com>
Sat, 17 Jun 2017 02:25:56 +0000 (02:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@305630 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/PowerPC/PPCTargetMachine.cpp

index d6bcd0ac3a354303d3df18d4419c2c6a121c5fb9..fd8df8c23353a42debef57d56d17603d38e5d384 100644 (file)
@@ -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