Skip to content

Commit a284a6e

Browse files
committed
[OpenMP] Guard OpenMP specific entry handling
1 parent 36d6b63 commit a284a6e

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

offload/plugins-nextgen/common/src/PluginInterface.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -380,7 +380,8 @@ setupIndirectCallTable(GenericPluginTy &Plugin, GenericDeviceTy &Device,
380380
Image.getTgtImage()->EntriesBegin, Image.getTgtImage()->EntriesEnd);
381381
llvm::SmallVector<std::pair<void *, void *>> IndirectCallTable;
382382
for (const auto &Entry : Entries) {
383-
if (Entry.Size == 0 || !(Entry.Flags & OMP_DECLARE_TARGET_INDIRECT))
383+
if (Entry.Kind != object::OffloadKind::OFK_OpenMP || Entry.Size == 0 ||
384+
!(Entry.Flags & OMP_DECLARE_TARGET_INDIRECT))
384385
continue;
385386

386387
assert(Entry.Size == sizeof(void *) && "Global not a function pointer?");

offload/src/PluginManager.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ __tgt_bin_desc *PluginManager::upgradeLegacyEntries(__tgt_bin_desc *Desc) {
156156
NewEntry.Data = Entry.Data;
157157
NewEntry.Size = Entry.Size;
158158
NewEntry.SymbolName = Entry.SymbolName;
159+
NewEntry.Kind = object::OffloadKind::OFK_OpenMP;
159160
}
160161

161162
// Create a new image struct so we can update the entries list.
@@ -186,7 +187,8 @@ void PluginManager::registerLib(__tgt_bin_desc *Desc) {
186187
// Add in all the OpenMP requirements associated with this binary.
187188
for (llvm::offloading::EntryTy &Entry :
188189
llvm::make_range(Desc->HostEntriesBegin, Desc->HostEntriesEnd))
189-
if (Entry.Flags == OMP_REGISTER_REQUIRES)
190+
if (Entry.Kind == object::OffloadKind::OFK_OpenMP &&
191+
Entry.Flags == OMP_REGISTER_REQUIRES)
190192
PM->addRequirements(Entry.Data);
191193

192194
// Extract the executable image and extra information if available.

0 commit comments

Comments
 (0)