diff options
author | Tom Stellard <tstellar@redhat.com> | 2018-11-29 00:31:15 +0000 |
---|---|---|
committer | Tom Stellard <tstellar@redhat.com> | 2018-11-29 00:31:15 +0000 |
commit | 1ee9092683099d418210b10041efa3d22a0cd07b (patch) | |
tree | d70cf5b27b6a3b42e6d17d080928e7ca59f96dbd | |
parent | 9ad6d0609a950e769315ce172de57536564eb3dc (diff) | |
download | llvm-1ee9092683099d418210b10041efa3d22a0cd07b.zip llvm-1ee9092683099d418210b10041efa3d22a0cd07b.tar.gz llvm-1ee9092683099d418210b10041efa3d22a0cd07b.tar.bz2 |
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.
------------------------------------------------------------------------
llvm-svn: 347822
-rw-r--r-- | clang/lib/Driver/ToolChains/Arch/PPC.cpp | 10 | ||||
-rw-r--r-- | clang/lib/Driver/ToolChains/Arch/PPC.h | 2 | ||||
-rw-r--r-- | clang/test/Driver/openbsd.c | 5 |
3 files changed, 13 insertions, 4 deletions
diff --git a/clang/lib/Driver/ToolChains/Arch/PPC.cpp b/clang/lib/Driver/ToolChains/Arch/PPC.cpp index f6a9596..791f120 100644 --- a/clang/lib/Driver/ToolChains/Arch/PPC.cpp +++ b/clang/lib/Driver/ToolChains/Arch/PPC.cpp @@ -107,15 +107,19 @@ void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, 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) { diff --git a/clang/lib/Driver/ToolChains/Arch/PPC.h b/clang/lib/Driver/ToolChains/Arch/PPC.h index 3acee91..4f3cd68 100644 --- a/clang/lib/Driver/ToolChains/Arch/PPC.h +++ b/clang/lib/Driver/ToolChains/Arch/PPC.h @@ -38,7 +38,7 @@ 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, +ReadGOTPtrMode getPPCReadGOTPtrMode(const Driver &D, const llvm::Triple &Triple, const llvm::opt::ArgList &Args); void getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple, diff --git a/clang/test/Driver/openbsd.c b/clang/test/Driver/openbsd.c index d3846b7..4aafa2f 100644 --- a/clang/test/Driver/openbsd.c +++ b/clang/test/Driver/openbsd.c @@ -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" |