summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGOpenMPRuntime.cpp
diff options
context:
space:
mode:
authorJonas Hahnfeld <hahnjo@hahnjo.de>2018-01-18 15:38:03 +0000
committerJonas Hahnfeld <hahnjo@hahnjo.de>2018-01-18 15:38:03 +0000
commit5e4df288e2a9a8e9da417ba4488504caa7eaf394 (patch)
tree2f2f9003632321f5479a68b913bf4f0ba2387023 /clang/lib/CodeGen/CGOpenMPRuntime.cpp
parentd8169a85cc124bb52c020f2eb808e75bba2c76e8 (diff)
downloadbcm5719-llvm-5e4df288e2a9a8e9da417ba4488504caa7eaf394.tar.gz
bcm5719-llvm-5e4df288e2a9a8e9da417ba4488504caa7eaf394.zip
[OpenMP] Correct generation of offloading entries
Firstly, each offloading entry must have a unique name or the linker will complain if there are multiple files with target regions. Secondly, the compiler must not introduce padding so mark the struct with a PackedAttr. Differential Revision: https://reviews.llvm.org/D42168 llvm-svn: 322858
Diffstat (limited to 'clang/lib/CodeGen/CGOpenMPRuntime.cpp')
-rw-r--r--clang/lib/CodeGen/CGOpenMPRuntime.cpp9
1 files changed, 4 insertions, 5 deletions
diff --git a/clang/lib/CodeGen/CGOpenMPRuntime.cpp b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
index 9c086287e12..7beb36ced5e 100644
--- a/clang/lib/CodeGen/CGOpenMPRuntime.cpp
+++ b/clang/lib/CodeGen/CGOpenMPRuntime.cpp
@@ -3573,11 +3573,9 @@ void CGOpenMPRuntime::createOffloadEntry(llvm::Constant *ID,
EntryInit.addInt(CGM.SizeTy, Size);
EntryInit.addInt(CGM.Int32Ty, Flags);
EntryInit.addInt(CGM.Int32Ty, 0);
- llvm::GlobalVariable *Entry =
- EntryInit.finishAndCreateGlobal(".omp_offloading.entry",
- Align,
- /*constant*/ true,
- llvm::GlobalValue::ExternalLinkage);
+ llvm::GlobalVariable *Entry = EntryInit.finishAndCreateGlobal(
+ Twine(".omp_offloading.entry.") + Name, Align,
+ /*constant*/ true, llvm::GlobalValue::ExternalLinkage);
// The entry has to be created in the section the linker expects it to be.
Entry->setSection(".omp_offloading.entries");
@@ -3760,6 +3758,7 @@ QualType CGOpenMPRuntime::getTgtOffloadEntryQTy() {
addFieldToRecordDecl(
C, RD, C.getIntTypeForBitwidth(/*DestWidth=*/32, /*Signed=*/true));
RD->completeDefinition();
+ RD->addAttr(PackedAttr::CreateImplicit(C));
TgtOffloadEntryQTy = C.getRecordType(RD);
}
return TgtOffloadEntryQTy;
OpenPOWER on IntegriCloud