summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2021-05-21 15:53:21 -0700
committerNick Desaulniers <ndesaulniers@google.com>2021-05-21 15:53:30 -0700
commit033138ea452f5f493fb5095e5963419905ad12e1 (patch)
treecc4bb3cf5aa64b9a508d8e879f217d079a429185 /clang/lib/CodeGen/CodeGenModule.cpp
parentab3cd2601bac99b26952c6f1015387d60800d2e2 (diff)
[IR] make stack-protector-guard-* flags into module attrs
D88631 added initial support for: - -mstack-protector-guard= - -mstack-protector-guard-reg= - -mstack-protector-guard-offset= flags, and D100919 extended these to AArch64. Unfortunately, these flags aren't retained for LTO. Make them module attributes rather than TargetOptions. Link: https://github.com/ClangBuiltLinux/linux/issues/1378 Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D102742
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 8d1b2ea5d522..744ccf0fe59f 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -777,6 +777,15 @@ void CodeGenModule::Release() {
if (!getCodeGenOpts().RecordCommandLine.empty())
EmitCommandLineMetadata();
+ if (!getCodeGenOpts().StackProtectorGuard.empty())
+ getModule().setStackProtectorGuard(getCodeGenOpts().StackProtectorGuard);
+ if (!getCodeGenOpts().StackProtectorGuardReg.empty())
+ getModule().setStackProtectorGuardReg(
+ getCodeGenOpts().StackProtectorGuardReg);
+ if (getCodeGenOpts().StackProtectorGuardOffset != INT_MAX)
+ getModule().setStackProtectorGuardOffset(
+ getCodeGenOpts().StackProtectorGuardOffset);
+
getTargetCodeGenInfo().emitTargetMetadata(*this, MangledDeclNames);
EmitBackendOptionsMetadata(getCodeGenOpts());