r347179 - [PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.
Brad Smith via cfe-commits
cfe-commits at lists.llvm.org
Sun Nov 18 16:21:07 PST 2018
Author: brad
Date: Sun Nov 18 16:21:06 2018
New Revision: 347179
URL: http://llvm.org/viewvc/llvm-project?rev=347179&view=rev
Log:
[PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.
OpenBSD/powerpc only supports Secure PLT.
Modified:
cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
cfe/trunk/test/Driver/openbsd.c
Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp?rev=347179&r1=347178&r2=347179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.cpp Sun Nov 18 16:21:06 2018
@@ -107,15 +107,19 @@ void ppc::getPPCTargetFeatures(const Dri
if (FloatABI == ppc::FloatABI::Soft)
Features.push_back("-hard-float");
- ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Args);
+ ppc::ReadGOTPtrMode ReadGOT = ppc::getPPCReadGOTPtrMode(D, Triple, Args);
if (ReadGOT == ppc::ReadGOTPtrMode::SecurePlt)
Features.push_back("+secure-plt");
}
-ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const ArgList &Args) {
+ppc::ReadGOTPtrMode ppc::getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple,
+ const ArgList &Args) {
if (Args.getLastArg(options::OPT_msecure_plt))
return ppc::ReadGOTPtrMode::SecurePlt;
- return ppc::ReadGOTPtrMode::Bss;
+ if (Triple.isOSOpenBSD())
+ return ppc::ReadGOTPtrMode::SecurePlt;
+ else
+ return ppc::ReadGOTPtrMode::Bss;
}
ppc::FloatABI ppc::getPPCFloatABI(const Driver &D, const ArgList &Args) {
Modified: cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h?rev=347179&r1=347178&r2=347179&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/PPC.h Sun Nov 18 16:21:06 2018
@@ -38,7 +38,7 @@ FloatABI getPPCFloatABI(const Driver &D,
std::string getPPCTargetCPU(const llvm::opt::ArgList &Args);
const char *getPPCAsmModeForCPU(StringRef Name);
-ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D,
+ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple,
const llvm::opt::ArgList &Args);
void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
Modified: cfe/trunk/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/openbsd.c?rev=347179&r1=347178&r2=347179&view=diff
==============================================================================
--- cfe/trunk/test/Driver/openbsd.c (original)
+++ cfe/trunk/test/Driver/openbsd.c Sun Nov 18 16:21:06 2018
@@ -112,3 +112,8 @@
// RUN: | FileCheck -check-prefix=CHECK-ARM-FLOAT-ABI %s
// CHECK-ARM-FLOAT-ABI-NOT: "-target-feature" "+soft-float"
// CHECK-ARM-FLOAT-ABI: "-target-feature" "+soft-float-abi"
+
+// Check PowerPC for Secure PLT
+// RUN: %clang -target powerpc-unknown-openbsd -### -c %s 2>&1 \
+// RUN: | FileCheck -check-prefix=CHECK-POWERPC-SECUREPLT %s
+// CHECK-POWERPC-SECUREPLT: "-target-feature" "+secure-plt"
More information about the cfe-commits
mailing list