summaryrefslogblamecommitdiff
path: root/user/llvm7/more-secure-plt.patch
blob: 1a32eea4fd7279b3682b37d3f1df655cf5b9648a (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13












                                                                               














                                                                                              
--- a/lib/Target/PowerPC/PPCSubtarget.cpp
+++ b/lib/Target/PowerPC/PPCSubtarget.cpp
@@ -138,6 +138,10 @@
   if (isDarwin())
     HasLazyResolverStubs = true;

+  // Set up musl-specific properties.
+  if (TargetTriple.getEnvironment() == Triple::Musl)
+    SecurePlt = true;
+
   if (HasSPE && IsPPC64)
     report_fatal_error( "SPE is only supported for 32-bit targets.\n", false);
   if (HasSPE && (HasAltivec || HasQPX || HasVSX || HasFPU))
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;
 }