[PATCH] D53383: [PowerPC] Make no-PIC default to match GCC - LLVM

Stefan Pintilie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 17 12:36:40 PDT 2018


stefanp created this revision.
stefanp added reviewers: nemanjai, kbarton, sfertile, lei, syzaara, hfinkel, joerg.
Herald added a subscriber: jsji.

Ran a quick test and determined that for GCC the default option is `-fno-PIC` for both ELFv1 and ELFv2. We are currently using `-fPIC` as the default for LLVM.
Would like to revert to what GCC is doing on PowerPC.

NOTE: This patch does not yet include test case updates. Currently working on those updates and will further update this patch at that time. In the meantime I put up this patch to make sure that this is in fact what we want to do.


https://reviews.llvm.org/D53383

Files:
  lib/Target/PowerPC/PPCTargetMachine.cpp


Index: lib/Target/PowerPC/PPCTargetMachine.cpp
===================================================================
--- lib/Target/PowerPC/PPCTargetMachine.cpp
+++ lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -214,11 +214,11 @@
   if (TT.isOSDarwin())
     return Reloc::DynamicNoPIC;
 
-  // Non-darwin 64-bit platforms are PIC by default.
-  if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le)
+  // Free BSD is PIC by default.
+  if (TT.isOSFreeBSD())
     return Reloc::PIC_;
 
-  // 32-bit is static by default.
+  // Otherwise is static by default.
   return Reloc::Static;
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D53383.170029.patch
Type: text/x-patch
Size: 600 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181017/a744010f/attachment.bin>


More information about the llvm-commits mailing list