[PATCH] D52013: Add support for powerpc64-*-linux-musl targets

A. Wilcox via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 12 21:45:59 PDT 2018


awilfox created this revision.
awilfox added a reviewer: hfinkel.
Herald added subscribers: kbarton, nemanjai.
awilfox edited the summary of this revision.

This patch ensures that 64-bit PowerPC musl targets use ELFv2 ABI on both endians.  source stating musl uses ELFv2 on both endians <https://www.openwall.com/lists/musl/2017/06/23/16>

I've tested this on multiple ppc64 hosts running musl and it works fine.  I am unsure whether there should be any unit tests added (what would they test?), but if there is a need for that, I will be happy to add it.

All expected tests passed when applied to LLVM 6.0.1 and trunk.

I am also unsure if this affects 32-bit PowerPC or not.  It did not seem to in my testing, and it shouldn't; however, if I need to add a TT.getArch() check to this, I will.


Repository:
  rL LLVM

https://reviews.llvm.org/D52013

Files:
  llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp


Index: llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp
===================================================================
--- llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -191,6 +191,10 @@
   if (TT.isMacOSX())
     return PPCTargetMachine::PPC_ABI_UNKNOWN;
 
+  // musl uses ELFv2 ABI on both endians.
+  if (TT.getEnvironment() == Triple::Musl)
+    return PPCTargetMachine::PPC_ABI_ELFv2;
+
   switch (TT.getArch()) {
   case Triple::ppc64le:
     return PPCTargetMachine::PPC_ABI_ELFv2;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52013.165200.patch
Type: text/x-patch
Size: 571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180913/cc7fae80/attachment.bin>


More information about the llvm-commits mailing list