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

A. Wilcox via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Oct 4 14:05:23 PDT 2018


awilfox updated this revision to Diff 168360.
awilfox added a comment.
Herald added a subscriber: jsji.

- The diff now has full context as requested.

- Per Samuel Holland, this did affect 32-bit PowerPC targets, so this patch has been changed to ensure it only affects 64-bit targets.

- Added a test to ppc64-elf-abi.ll to ensure musl is generating ELFv2 code on big endian.  The test does pass when the patch is applied.

This still applies to 6.0.1, though obviously not cleanly with full context.  It was written against trunk.


https://reviews.llvm.org/D52013

Files:
  lib/Target/PowerPC/PPCTargetMachine.cpp
  test/CodeGen/PowerPC/ppc64-elf-abi.ll


Index: test/CodeGen/PowerPC/ppc64-elf-abi.ll
===================================================================
--- test/CodeGen/PowerPC/ppc64-elf-abi.ll
+++ test/CodeGen/PowerPC/ppc64-elf-abi.ll
@@ -1,6 +1,7 @@
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv1
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
+; RUN: llc -verify-machineinstrs -mtriple=powerpc64-unknown-linux-musl < %s | FileCheck %s -check-prefix=CHECK-ELFv2
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv1 < %s | FileCheck %s -check-prefix=CHECK-ELFv1
 ; RUN: llc -verify-machineinstrs -mtriple=powerpc64le-unknown-linux-gnu -target-abi elfv2 < %s | FileCheck %s -check-prefix=CHECK-ELFv2
Index: lib/Target/PowerPC/PPCTargetMachine.cpp
===================================================================
--- lib/Target/PowerPC/PPCTargetMachine.cpp
+++ lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -199,6 +199,10 @@
   case Triple::ppc64le:
     return PPCTargetMachine::PPC_ABI_ELFv2;
   case Triple::ppc64:
+    // musl uses ELFv2 ABI on both endians.
+    if (TT.getEnvironment() == Triple::Musl)
+      return PPCTargetMachine::PPC_ABI_ELFv2;
+
     return PPCTargetMachine::PPC_ABI_ELFv1;
   default:
     return PPCTargetMachine::PPC_ABI_UNKNOWN;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52013.168360.patch
Type: text/x-patch
Size: 1672 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20181004/8fe5d9ad/attachment.bin>


More information about the llvm-commits mailing list