summaryrefslogtreecommitdiff
path: root/clang/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorNick Desaulniers <ndesaulniers@google.com>2021-06-08 08:22:48 -0700
committerNick Desaulniers <ndesaulniers@google.com>2021-06-08 08:31:04 -0700
commit433c8d950cb3a1fa0977355ce0367e8c763a3f13 (patch)
tree925ab99b1f6fad5aa16b8c40d5297219a7a0fb69 /clang/lib/CodeGen/CodeGenModule.cpp
parentc5d56fec502f36a0c994835ca23bc93a6c682d95 (diff)
[IR] make -stack-alignment= into a module attr
Similar to D102742, specifying the stack alignment via CodegenOpts means that this flag gets dropped during LTO, unless the command line is re-specified as a plugin opt. Instead, encode this information as a module level attribute so that we don't have to expose this llvm internal flag when linking the Linux kernel with LTO. Looks like external dependencies might need a fix: * https://github.com/llvm-hs/llvm-hs/issues/345 * https://github.com/halide/Halide/issues/6079 Link: https://github.com/ClangBuiltLinux/linux/issues/1377 Reviewed By: tejohnson Differential Revision: https://reviews.llvm.org/D103048
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 1f23ce7de52b..c93339a211f3 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -785,6 +785,8 @@ void CodeGenModule::Release() {
if (getCodeGenOpts().StackProtectorGuardOffset != INT_MAX)
getModule().setStackProtectorGuardOffset(
getCodeGenOpts().StackProtectorGuardOffset);
+ if (getCodeGenOpts().StackAlignment)
+ getModule().setOverrideStackAlignment(getCodeGenOpts().StackAlignment);
getTargetCodeGenInfo().emitTargetMetadata(*this, MangledDeclNames);