summaryrefslogtreecommitdiff
path: root/user/llvm6/musl-ppc64-elfv2.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2018-10-04 21:09:36 +0000
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2018-10-04 21:09:36 +0000
commit49cec2be42835f6b4c5ff1bad4710e20db422b87 (patch)
tree1e83670bbd93e2af24cb054cfc657444ecdac84b /user/llvm6/musl-ppc64-elfv2.patch
parent48e146876c51711b9edfb9095b39a8577ed0ea8f (diff)
downloadpackages-49cec2be42835f6b4c5ff1bad4710e20db422b87.tar.gz
packages-49cec2be42835f6b4c5ff1bad4710e20db422b87.tar.bz2
packages-49cec2be42835f6b4c5ff1bad4710e20db422b87.tar.xz
packages-49cec2be42835f6b4c5ff1bad4710e20db422b87.zip
user/llvm6: Fix ELFv2 patch, more secure PLT fixes for ppc32
Diffstat (limited to 'user/llvm6/musl-ppc64-elfv2.patch')
-rw-r--r--user/llvm6/musl-ppc64-elfv2.patch52
1 files changed, 41 insertions, 11 deletions
diff --git a/user/llvm6/musl-ppc64-elfv2.patch b/user/llvm6/musl-ppc64-elfv2.patch
index 6fa65526b..016be5dad 100644
--- a/user/llvm6/musl-ppc64-elfv2.patch
+++ b/user/llvm6/musl-ppc64-elfv2.patch
@@ -1,13 +1,43 @@
---- llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp.orig 2018-09-13 03:51:11.900000000 +0000
-+++ llvm-6.0.1.src/lib/Target/PowerPC/PPCTargetMachine.cpp 2018-09-13 03:56:10.740000000 +0000
-@@ -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()) {
+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;
+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
++++ b/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
+--
+2.18.0
+