[llvm-branch-commits] [cfe-branch] r347822 - Merging r347179:

Tom Stellard via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Nov 28 16:31:15 PST 2018


Author: tstellar
Date: Wed Nov 28 16:31:15 2018
New Revision: 347822

URL: http://llvm.org/viewvc/llvm-project?rev=347822&view=rev
Log:
Merging r347179:

------------------------------------------------------------------------
r347179 | brad | 2018-11-18 16:21:06 -0800 (Sun, 18 Nov 2018) | 4 lines

[PowerPC] Set the default PLT mode on OpenBSD/powerpc to Secure PLT.

OpenBSD/powerpc only supports Secure PLT.

------------------------------------------------------------------------

Modified:
    cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.cpp
    cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.h
    cfe/branches/release_70/test/Driver/openbsd.c

Modified: cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.cpp?rev=347822&r1=347821&r2=347822&view=diff
==============================================================================
--- cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.cpp (original)
+++ cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.cpp Wed Nov 28 16:31:15 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/branches/release_70/lib/Driver/ToolChains/Arch/PPC.h
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.h?rev=347822&r1=347821&r2=347822&view=diff
==============================================================================
--- cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.h (original)
+++ cfe/branches/release_70/lib/Driver/ToolChains/Arch/PPC.h Wed Nov 28 16:31:15 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/branches/release_70/test/Driver/openbsd.c
URL: http://llvm.org/viewvc/llvm-project/cfe/branches/release_70/test/Driver/openbsd.c?rev=347822&r1=347821&r2=347822&view=diff
==============================================================================
--- cfe/branches/release_70/test/Driver/openbsd.c (original)
+++ cfe/branches/release_70/test/Driver/openbsd.c Wed Nov 28 16:31:15 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 llvm-branch-commits mailing list