summaryrefslogtreecommitdiff
path: root/lib/Driver/ToolChains/Arch/PPC.cpp
diff options
context:
space:
mode:
authorStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2018-04-11 12:24:44 +0000
committerStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2018-04-11 12:24:44 +0000
commit378e40edd0141f64d690308cdfba071e87a2828b (patch)
tree31be8fc2f1e2e2174d80d14daea04dcfccbd3ae7 /lib/Driver/ToolChains/Arch/PPC.cpp
parent45c3242e808b48e6c017f00eb64cc0a58b52d8ad (diff)
downloadclang-378e40edd0141f64d690308cdfba071e87a2828b.tar.gz
[PowerPC] Option for secure plt mode
This patch enables option for secure plt mode in clang (-msecure-plt). Differential Revision: https://reviews.llvm.org/D44921 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@329795 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/Arch/PPC.cpp')
-rw-r--r--lib/Driver/ToolChains/Arch/PPC.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/lib/Driver/ToolChains/Arch/PPC.cpp b/lib/Driver/ToolChains/Arch/PPC.cpp
index 7c7e1c70e5..f6a95962ac 100644
--- a/lib/Driver/ToolChains/Arch/PPC.cpp
+++ b/lib/Driver/ToolChains/Arch/PPC.cpp
@@ -106,6 +106,16 @@ void ppc::getPPCTargetFeatures(const Driver &D, const llvm::Triple &Triple,
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) {