summaryrefslogtreecommitdiff
path: root/user/clang/secure-plt.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/clang/secure-plt.patch')
-rw-r--r--user/clang/secure-plt.patch81
1 files changed, 11 insertions, 70 deletions
diff --git a/user/clang/secure-plt.patch b/user/clang/secure-plt.patch
index c1b4cb1de..a92071e52 100644
--- a/user/clang/secure-plt.patch
+++ b/user/clang/secure-plt.patch
@@ -1,70 +1,11 @@
-Index: cfe/include/clang/Driver/Options.td
-===================================================================
---- cfe/include/clang/Driver/Options.td
-+++ cfe/include/clang/Driver/Options.td
-@@ -1957,6 +1957,7 @@
- def mno_altivec : Flag<["-"], "mno-altivec">, Group<m_ppc_Features_Group>;
- def mvsx : Flag<["-"], "mvsx">, Group<m_ppc_Features_Group>;
- def mno_vsx : Flag<["-"], "mno-vsx">, Group<m_ppc_Features_Group>;
-+def msecure_plt : Flag<["-"], "msecure-plt">, Group<m_ppc_Features_Group>;
- def mpower8_vector : Flag<["-"], "mpower8-vector">,
- Group<m_ppc_Features_Group>;
- def mno_power8_vector : Flag<["-"], "mno-power8-vector">,
-Index: cfe/lib/Driver/ToolChains/Arch/PPC.h
-===================================================================
---- cfe/lib/Driver/ToolChains/Arch/PPC.h
-+++ cfe/lib/Driver/ToolChains/Arch/PPC.h
-@@ -29,10 +29,17 @@
- Hard,
- };
-
-+enum class ReadGOTPtrMode {
-+ Bss,
-+ SecurePlt,
-+};
-+
- FloatABI getPPCFloatABI(const Driver &D, const llvm::opt::ArgList &Args);
-
- std::string getPPCTargetCPU(const llvm::opt::ArgList &Args);
- const char *getPPCAsmModeForCPU(StringRef Name);
-+ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D,
-+ const llvm::opt::ArgList &Args);
-
- void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
- const llvm::opt::ArgList &Args,
-Index: cfe/lib/Driver/ToolChains/Arch/PPC.cpp
-===================================================================
---- cfe/lib/Driver/ToolChains/Arch/PPC.cpp
-+++ cfe/lib/Driver/ToolChains/Arch/PPC.cpp
-@@ -106,6 +106,16 @@
- ppc::FloatABI FloatABI = ppc::getPPCFloatABI(D, Args);
- if (FloatABI == ppc::FloatABI::Soft)
- Features.push_back("-hard-float");
-+
-+ ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Args);
-+ if (ReadGOT == ppc::ReadGOTPtrMode::SecurePlt)
-+ Features.push_back("+secure-plt");
-+}
-+
-+ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const ArgList &Args) {
-+ if (Args.getLastArg(options::OPT_msecure_plt))
-+ return ppc::ReadGOTPtrMode::SecurePlt;
-+ return ppc::ReadGOTPtrMode::Bss;
- }
-
- ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) {
-Index: cfe/test/Driver/ppc-features.cpp
-===================================================================
---- cfe/test/Driver/ppc-features.cpp
-+++ cfe/test/Driver/ppc-features.cpp
-@@ -22,6 +22,10 @@
- // RUN: %clang -target powerpc-unknown-linux-gnu %s -msoft-float -mhard-float -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SOFTHARD %s
- // CHECK-SOFTHARD-NOT: "-target-feature" "-hard-float"
-
-+// check -msecure-plt option for ppc32
-+// RUN: %clang -target powerpc-unknown-linux-gnu -msecure-plt %s -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-SECUREPLT %s
-+// CHECK-SECUREPLT: "-target-feature" "+secure-plt"
-+
- // check -mfloat-abi=x option
- // RUN: %clang -target powerpc-unknown-linux-gnu %s -mfloat-abi=x -### -o %t.o 2>&1 | FileCheck --check-prefix=CHECK-ERRMSG %s
- // CHECK-ERRMSG: error: invalid float ABI '-mfloat-abi=x'
+--- cfe-7.0.1.src/lib/Driver/ToolChains/Arch/PPC.cpp.old 2018-11-29 00:31:15.000000000 +0000
++++ cfe-7.0.1.src/lib/Driver/ToolChains/Arch/PPC.cpp 2019-03-10 04:37:49.350000000 +0000
+@@ -116,7 +116,7 @@
+ const ArgList &Args) {
+ if (Args.getLastArg(options::OPT_msecure_plt))
+ return ppc::ReadGOTPtrMode::SecurePlt;
+- if (Triple.isOSOpenBSD())
++ if (Triple.isOSOpenBSD() || Triple.isMusl())
+ return ppc::ReadGOTPtrMode::SecurePlt;
+ else
+ return ppc::ReadGOTPtrMode::Bss;