From 433c8d950cb3a1fa0977355ce0367e8c763a3f13 Mon Sep 17 00:00:00 2001 From: Nick Desaulniers Date: Tue, 8 Jun 2021 08:22:48 -0700 Subject: [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 --- clang/lib/CodeGen/CodeGenModule.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') 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); -- cgit v1.2.3