llvm6.0: update ppc64 patches to always use elfv2 on BE

We need this because we target elfv2 with ppc64 glibc as well,
unlike most distributions.

[ci skip]

Closes: #11357 [via git-merge-pr]
This commit is contained in:
q66 2019-04-27 16:36:11 +02:00 committed by Jürgen Buchmüller
parent 84f1c69cb1
commit f82caf1c5f
2 changed files with 16 additions and 32 deletions

View file

@ -1,43 +1,27 @@
From 750d323a6060ad92c3d247f85d6555041f55b4a5 Mon Sep 17 00:00:00 2001 This patches LLVM to use ELFv2 on ppc64 uncoditionally unless overridden. We
From: "A. Wilcox" <AWilcox@Wilcox-Tech.com> need this because unlike most distros we use ELFv2 for both glibc and musl
Date: Thu, 4 Oct 2018 15:26:59 -0500 on big endian ppc64.
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 --- a/lib/Target/PowerPC/PPCTargetMachine.cpp
+++ b/lib/Target/PowerPC/PPCTargetMachine.cpp +++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
@@ -199,6 +199,10 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT, @@ -197,9 +197,9 @@ static PPCTargetMachine::PPCABI computeTargetABI(const Triple &TT,
switch (TT.getArch()) {
case Triple::ppc64le: case Triple::ppc64le:
return PPCTargetMachine::PPC_ABI_ELFv2; - return PPCTargetMachine::PPC_ABI_ELFv2;
case Triple::ppc64: case Triple::ppc64:
+ // musl uses ELFv2 ABI on both endians. - return PPCTargetMachine::PPC_ABI_ELFv1;
+ if (TT.getEnvironment() == Triple::Musl) + /* we use elfv2 by default for both endians and both libcs */
+ return PPCTargetMachine::PPC_ABI_ELFv2; + return PPCTargetMachine::PPC_ABI_ELFv2;
+
return PPCTargetMachine::PPC_ABI_ELFv1;
default: default:
return PPCTargetMachine::PPC_ABI_UNKNOWN; return PPCTargetMachine::PPC_ABI_UNKNOWN;
diff --git a/test/CodeGen/PowerPC/ppc64-elf-abi.ll b/test/CodeGen/PowerPC/ppc64-elf-abi.ll }
index 1e17930304b..aa594b37b47 100644
--- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll --- a/test/CodeGen/PowerPC/ppc64-elf-abi.ll
+++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll +++ b/test/CodeGen/PowerPC/ppc64-elf-abi.ll
@@ -1,6 +1,7 @@ @@ -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-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 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-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 < %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
--
2.18.0

View file

@ -1,7 +1,7 @@
# Template file for 'llvm6.0' # Template file for 'llvm6.0'
pkgname=llvm6.0 pkgname=llvm6.0
version=6.0.1 version=6.0.1
revision=4 revision=5
wrksrc="llvm-${version}.src" wrksrc="llvm-${version}.src"
lib32disabled=yes lib32disabled=yes
build_style=cmake build_style=cmake