aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/Transforms/Utils/ModuleUtils.cpp
diff options
context:
space:
mode:
authorJoseph Huber <jhuber6@vols.utk.edu>2022-03-25 11:03:02 -0400
committerJoseph Huber <jhuber6@vols.utk.edu>2022-04-15 20:35:26 -0400
commit984a0dc386553f28068716a087d65ccf8a92889b (patch)
treecf1860f5750b21a8c032da09644afbcda89ebb70 /llvm/lib/Transforms/Utils/ModuleUtils.cpp
parentcac81161ed1386b32443e13ab513c6a3d081d6a7 (diff)
downloadllvm-984a0dc386553f28068716a087d65ccf8a92889b.zip
llvm-984a0dc386553f28068716a087d65ccf8a92889b.tar.gz
llvm-984a0dc386553f28068716a087d65ccf8a92889b.tar.bz2
[OpenMP] Use new offloading binary when embedding offloading images
The previous patch introduced the offloading binary format so we can store some metada along with the binary image. This patch introduces using this inside the linker wrapper and Clang instead of the previous method that embedded the metadata in the section name. Differential Revision: https://reviews.llvm.org/D122683
Diffstat (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp')
-rw-r--r--llvm/lib/Transforms/Utils/ModuleUtils.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/llvm/lib/Transforms/Utils/ModuleUtils.cpp b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
index c77c18e..7388a4b 100644
--- a/llvm/lib/Transforms/Utils/ModuleUtils.cpp
+++ b/llvm/lib/Transforms/Utils/ModuleUtils.cpp
@@ -265,15 +265,15 @@ void VFABI::setVectorVariantNames(CallInst *CI,
}
void llvm::embedBufferInModule(Module &M, MemoryBufferRef Buf,
- StringRef SectionName) {
- // Embed the buffer into the module.
+ StringRef SectionName, Align Alignment) {
+ // Embed the memory buffer into the module.
Constant *ModuleConstant = ConstantDataArray::get(
M.getContext(), makeArrayRef(Buf.getBufferStart(), Buf.getBufferSize()));
GlobalVariable *GV = new GlobalVariable(
- M, ModuleConstant->getType(), true, GlobalValue::ExternalLinkage,
- ModuleConstant, SectionName.drop_front());
+ M, ModuleConstant->getType(), true, GlobalValue::PrivateLinkage,
+ ModuleConstant, "llvm.embedded.object");
GV->setSection(SectionName);
- GV->setVisibility(GlobalValue::HiddenVisibility);
+ GV->setAlignment(Alignment);
appendToCompilerUsed(M, GV);
}