[PATCH] D42168: [OpenMP] Generate unique name for offloading entries

Jonas Hahnfeld via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 17 05:13:03 PST 2018

Hahnfeld created this revision.
Hahnfeld added reviewers: gtbercea, ABataev, carlo.bertolli.
Herald added subscribers: cfe-commits, guansong.

If there are multiple files with target regions, each file and
region must generate a unique name or the linker will complain.

  rC Clang



Index: lib/CodeGen/CGOpenMPRuntime.cpp
--- lib/CodeGen/CGOpenMPRuntime.cpp
+++ lib/CodeGen/CGOpenMPRuntime.cpp
@@ -3573,11 +3573,11 @@
   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);
+  SmallString<128> EntryGblName(".omp_offloading.entry.");
+  EntryGblName += Name;
+  llvm::GlobalVariable *Entry = EntryInit.finishAndCreateGlobal(
+      EntryGblName, Align,
+      /*constant*/ true, llvm::GlobalValue::ExternalLinkage);
   // The entry has to be created in the section the linker expects it to be.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42168.130146.patch
Type: text/x-patch
Size: 960 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180117/625ae447/attachment.bin>

More information about the cfe-commits mailing list