diff options
author | Joseph Huber <jhuber6@vols.utk.edu> | 2022-07-05 12:55:36 -0400 |
---|---|---|
committer | Joseph Huber <jhuber6@vols.utk.edu> | 2022-07-07 12:20:40 -0400 |
commit | 41fba3c107a5bc99065f3bf8b9f5b9d52eab2d98 (patch) | |
tree | a2b027cacc1b9119e227776a3de7828e469561f9 /llvm/lib/Transforms/Utils/ModuleUtils.cpp | |
parent | 82a0adf0f78d5be8a727d9537627e2a6f7e8e105 (diff) | |
download | llvm-41fba3c107a5bc99065f3bf8b9f5b9d52eab2d98.zip llvm-41fba3c107a5bc99065f3bf8b9f5b9d52eab2d98.tar.gz llvm-41fba3c107a5bc99065f3bf8b9f5b9d52eab2d98.tar.bz2 |
[Metadata] Add 'exclude' metadata to add the exclude flags on globals
This patchs adds a new metadata kind `exclude` which implies that the
global variable should be given the necessary flags during code
generation to not be included in the final executable. This is done
using the ``SHF_EXCLUDE`` flag on ELF for example. This should make it
easier to specify this flag on a variable without needing to explicitly
check the section name in the target backend.
Depends on D129053 D129052
Reviewed By: jdoerfert
Differential Revision: https://reviews.llvm.org/D129151
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
-rw-r--r-- | llvm/lib/Transforms/Utils/ModuleUtils.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp index a3529bf..4dcba65 100644 --- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp +++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp @@ -281,6 +281,7 @@ void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf, MDString::get(Ctx, SectionName)}; MD->addOperand(llvm::MDNode::get(Ctx, MDVals)); + GV->setMetadata(LLVMContext::MD_exclude, llvm::MDNode::get(Ctx, {})); appendToCompilerUsed(M, GV); } |