summaryrefslogtreecommitdiff
path: root/user/llvm6/more-secure-plt.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/more-secure-plt.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/more-secure-plt.patch')
-rw-r--r--user/llvm6/more-secure-plt.patch38
1 files changed, 38 insertions, 0 deletions
diff --git a/user/llvm6/more-secure-plt.patch b/user/llvm6/more-secure-plt.patch
new file mode 100644
index 000000000..1cc08a9a8
--- /dev/null
+++ b/user/llvm6/more-secure-plt.patch
@@ -0,0 +1,38 @@
+diff --git a/lib/Target/PowerPC/PPCSubtarget.cpp b/lib/Target/PowerPC/PPCSubtarget.cpp
+index c0cbfd779cb..5d7a021c3e2 100644
+--- a/lib/Target/PowerPC/PPCSubtarget.cpp
++++ b/lib/Target/PowerPC/PPCSubtarget.cpp
+@@ -106,6 +106,7 @@
+ HasFloat128 = false;
+ IsISA3_0 = false;
+ UseLongCalls = false;
++ SecurePlt = false;
+
+ HasPOPCNTD = POPCNTD_Unavailable;
+ }
+@@ -136,6 +137,10 @@
+ if (isDarwin())
+ HasLazyResolverStubs = true;
+
++ // Set up musl-specific properties.
++ if (TargetTriple.getEnvironment() == Triple::Musl)
++ SecurePlt = true;
++
+ // QPX requires a 32-byte aligned stack. Note that we need to do this if
+ // we're compiling for a BG/Q system regardless of whether or not QPX
+ // is enabled because external functions will assume this alignment.
+diff --git a/lib/Target/PowerPC/PPCTargetMachine.cpp b/lib/Target/PowerPC/PPCTargetMachine.cpp
+index c583fba8cab..6a9eedf89c5 100644
+--- a/lib/Target/PowerPC/PPCTargetMachine.cpp
++++ b/lib/Target/PowerPC/PPCTargetMachine.cpp
+@@ -222,6 +222,10 @@ static Reloc::Model getEffectiveRelocModel(const Triple &TT,
+ if (TT.getArch() == Triple::ppc64 || TT.getArch() == Triple::ppc64le)
+ return Reloc::PIC_;
+
++ // musl needs SecurePlt, which depends on PIC.
++ if (TT.getEnvironment() == Triple::Musl)
++ return Reloc::PIC_;
++
+ // 32-bit is static by default.
+ return Reloc::Static;
+ }