void-packages/srcpkgs/rust/files/patches/internal-llvm/llvm-002-musl-ppc64-elfv2.p...

29 lines
1.1 KiB
Diff

From 750d323a6060ad92c3d247f85d6555041f55b4a5 Mon Sep 17 00:00:00 2001
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
Date: Thu, 4 Oct 2018 15:26:59 -0500
Subject: [PATCH] Add support for powerpc64-*-linux-musl targets
This patch ensures that 64-bit PowerPC musl targets use ELFv2 ABI on both
endians. It additionally adds a test that big endian PPC64 uses ELFv2 on
musl.
---
lib/Target/PowerPC/PPCTargetMachine.cpp | 4 ++++
test/CodeGen/PowerPC/ppc64-elf-abi.ll | 1 +
2 files changed, 5 insertions(+)
diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
index 34410393ef6..c583fba8cab 100644
--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -199,6 +199,10 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
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;