[PATCH] D26564: Use PIC relocation mode by default for PowerPC64 ELF

Joerg Sonnenberger via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Dec 14 16:13:21 PST 2016


This revision was automatically updated to reflect the committed changes.
Closed by commit rL289744: Use PIC relocation mode by default for PowerPC64 ELF (authored by joerg).

Changed prior to commit:
  https://reviews.llvm.org/D26564?vs=77670&id=81495#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D26564

Files:
  cfe/trunk/lib/Driver/ToolChains.cpp
  cfe/trunk/test/Driver/ppc-abi.c


Index: cfe/trunk/test/Driver/ppc-abi.c
===================================================================
--- cfe/trunk/test/Driver/ppc-abi.c
+++ cfe/trunk/test/Driver/ppc-abi.c
@@ -24,7 +24,10 @@
 // RUN: %clang -target powerpc64le-unknown-linux-gnu %s -### -o %t.o 2>&1 \
 // RUN:   -mabi=altivec | FileCheck -check-prefix=CHECK-ELFv2 %s
 
+// CHECK-ELFv1: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1: "-target-abi" "elfv1"
+// CHECK-ELFv1-QPX: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv1-QPX: "-target-abi" "elfv1-qpx"
+// CHECK-ELFv2: "-mrelocation-model" "pic" "-pic-level" "2"
 // CHECK-ELFv2: "-target-abi" "elfv2"
 
Index: cfe/trunk/lib/Driver/ToolChains.cpp
===================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp
+++ cfe/trunk/lib/Driver/ToolChains.cpp
@@ -2879,7 +2879,15 @@
 }
 
 bool Generic_GCC::isPICDefault() const {
-  return getArch() == llvm::Triple::x86_64 && getTriple().isOSWindows();
+  switch (getArch()) {
+  case llvm::Triple::x86_64:
+    return getTriple().isOSWindows();
+  case llvm::Triple::ppc64:
+  case llvm::Triple::ppc64le:
+    return !getTriple().isOSBinFormatMachO() && !getTriple().isMacOSX();
+  default:
+    return false;
+  }
 }
 
 bool Generic_GCC::isPIEDefault() const { return false; }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D26564.81495.patch
Type: text/x-patch
Size: 1318 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20161215/e8051714/attachment.bin>


More information about the cfe-commits mailing list