diff --git a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp --- a/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp +++ b/openmp/libomptarget/plugins-nextgen/amdgpu/src/rtl.cpp @@ -2583,22 +2583,6 @@ // Store the symbol address on the device global metadata. DeviceGlobal.setPtr(reinterpret_cast(SymbolAddr)); - return Plugin::success(); - } - -private: - /// Extract the global's information from the ELF image, section, and symbol. - Error getGlobalMetadataFromELF(const DeviceImageTy &Image, - const ELF64LE::Sym &Symbol, - const ELF64LE::Shdr &Section, - GlobalTy &ImageGlobal) override { - // The global's address in AMDGPU is computed as the image begin + the ELF - // symbol value. Notice we do not add the ELF section offset. - ImageGlobal.setPtr(advanceVoidPtr(Image.getStart(), Symbol.st_value)); - - // Set the global's size. - ImageGlobal.setSize(Symbol.st_size); - return Plugin::success(); } }; diff --git a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp --- a/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp +++ b/openmp/libomptarget/plugins-nextgen/common/PluginInterface/GlobalHandler.cpp @@ -53,8 +53,8 @@ // The global's address is computed as the image begin + the ELF section // offset + the ELF symbol value. - ImageGlobal.setPtr( - advanceVoidPtr(Image.getStart(), Section.sh_offset + Symbol.st_value)); + ImageGlobal.setPtr(advanceVoidPtr( + Image.getStart(), Section.sh_offset - Section.sh_addr + Symbol.st_value)); // Set the global's size. ImageGlobal.setSize(Symbol.st_size);