From bb869f42b7cd724e6ebb5185a7536c4cd9eb3f7d Mon Sep 17 00:00:00 2001 From: Joachim Protze Date: Wed, 18 Jul 2018 07:23:46 +0000 Subject: [libomptarget] Also support several images for elf In revision r336569 (D49036) libomptarget support for multiple nvidia images has been fixed in case a target region resides inside one or multiple libraries and in the compiled application. But the issues is still present for elf images. This fix will also support multiple images for elf. Patch by Jannis Klinkenberg Reviewers: protze.joachim, ABataev, grokos Reviewed By: protze.joachim, ABataev, grokos Subscribers: openmp-commits Differential Revision: https://reviews.llvm.org/D49418 llvm-svn: 337355 --- openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'openmp') diff --git a/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp b/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp index 558388dbce6..951710a6782 100644 --- a/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp +++ b/openmp/libomptarget/plugins/generic-elf-64bit/src/rtl.cpp @@ -66,7 +66,7 @@ struct FuncOrGblEntryTy { /// Class containing all the device information. class RTLDeviceInfoTy { - std::vector FuncGblEntries; + std::vector> FuncGblEntries; public: std::list DynLibs; @@ -76,7 +76,8 @@ public: __tgt_offload_entry *end) { assert(device_id < (int32_t)FuncGblEntries.size() && "Unexpected device id!"); - FuncOrGblEntryTy &E = FuncGblEntries[device_id]; + FuncGblEntries[device_id].emplace_back(); + FuncOrGblEntryTy &E = FuncGblEntries[device_id].back(); E.Table.EntriesBegin = begin; E.Table.EntriesEnd = end; @@ -86,7 +87,7 @@ public: bool findOffloadEntry(int32_t device_id, void *addr) { assert(device_id < (int32_t)FuncGblEntries.size() && "Unexpected device id!"); - FuncOrGblEntryTy &E = FuncGblEntries[device_id]; + FuncOrGblEntryTy &E = FuncGblEntries[device_id].back(); for (__tgt_offload_entry *i = E.Table.EntriesBegin, *e = E.Table.EntriesEnd; i < e; ++i) { @@ -101,7 +102,7 @@ public: __tgt_target_table *getOffloadEntriesTable(int32_t device_id) { assert(device_id < (int32_t)FuncGblEntries.size() && "Unexpected device id!"); - FuncOrGblEntryTy &E = FuncGblEntries[device_id]; + FuncOrGblEntryTy &E = FuncGblEntries[device_id].back(); return &E.Table; } -- cgit v1.2.3