From 984a0dc386553f28068716a087d65ccf8a92889b Mon Sep 17 00:00:00 2001 From: Joseph Huber Date: Fri, 25 Mar 2022 11:03:02 -0400 Subject: [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 --- llvm/lib/Transforms/Utils/ModuleUtils.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'llvm/lib/Transforms/Utils/ModuleUtils.cpp') 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); } -- cgit v1.1