aboutsummaryrefslogtreecommitdiff
path: root/clang/lib
diff options
context:
space:
mode:
authorWolfgang Pieb <wolfgang_pieb@playstation.sony.com>2023-02-06 13:50:37 -0800
committerWolfgang Pieb <wolfgang_pieb@playstation.sony.com>2023-02-08 10:34:56 -0800
commit5d07e0448e38d4be0cc7b1079d72b5e3644e941c (patch)
treef98ec36c2a5f4df3a9ee87516335f8a72f206769 /clang/lib
parent66b8d2bb71298cf3f406593464c6d729b7817f51 (diff)
downloadllvm-5d07e0448e38d4be0cc7b1079d72b5e3644e941c.zip
llvm-5d07e0448e38d4be0cc7b1079d72b5e3644e941c.tar.gz
llvm-5d07e0448e38d4be0cc7b1079d72b5e3644e941c.tar.bz2
[TLS]: Clamp the alignment of TLS global variables if required by the target
Adding a module flag 'MaxTLSAlign' describing the maximum alignment a global TLS variable can have. Optimizers are prevented from increasing the alignment of such variables beyond this threshold. Reviewed By: probinson Differential Revision: https://reviews.llvm.org/D140123
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/CodeGen/CodeGenModule.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp
index 57c9e58..0f93c33 100644
--- a/clang/lib/CodeGen/CodeGenModule.cpp
+++ b/clang/lib/CodeGen/CodeGenModule.cpp
@@ -947,6 +947,10 @@ void CodeGenModule::Release() {
if (getCodeGenOpts().SkipRaxSetup)
getModule().addModuleFlag(llvm::Module::Override, "SkipRaxSetup", 1);
+ if (getContext().getTargetInfo().getMaxTLSAlign())
+ getModule().addModuleFlag(llvm::Module::Error, "MaxTLSAlign",
+ getContext().getTargetInfo().getMaxTLSAlign());
+
getTargetCodeGenInfo().emitTargetMetadata(*this, MangledDeclNames);
EmitBackendOptionsMetadata(getCodeGenOpts());