void-packages/srcpkgs/llvm8/files/patches/llvm/llvm-002-musl-ppc64-elfv2.patch
q66 e95a5e9ae4 llvm8: update ppc64 patches to always use elfv2 on big endian
We need this because we target elfv2 with ppc64 glibc as well,
unlike most distributions.

[ci skip]
2019-04-27 17:00:03 +02:00

27 lines
1.5 KiB
Diff

This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
need this because unlike most distros we use ELFv2 for both glibc and musl
on big endian ppc64.
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -197,9 +197,9 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
switch (TT.getArch()) {
case Triple::ppc64le:
- return PPCTargetMachine::PPC_ABI_ELFv2;
case Triple::ppc64:
- return PPCTargetMachine::PPC_ABI_ELFv1;
+ /* we use elfv2 by default for both endians and both libcs */
+ return PPCTargetMachine::PPC_ABI_ELFv2;
default:
return PPCTargetMachine::PPC_ABI_UNKNOWN;
}
--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
@@ -1,4 +1,5 @@
-; 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 < %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=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=powerpc64le-unknown-linux-gnu < %s | FileCheck %s -check-prefix=CHECK-ELFv2