[Openmp-commits] [openmp] [libomptarget] Support BE ELF files in plugins-nextgen (PR #83976)

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Wed Mar 6 07:48:30 PST 2024


================
@@ -81,55 +71,36 @@ Error GenericGlobalHandlerTy::moveGlobalBetweenDeviceAndHost(
 bool GenericGlobalHandlerTy::isSymbolInImage(GenericDeviceTy &Device,
                                              DeviceImageTy &Image,
                                              StringRef SymName) {
-  // Get the ELF object file for the image. Notice the ELF object may already
-  // be created in previous calls, so we can reuse it. If this is unsuccessful
-  // just return false as we couldn't find it.
-  auto ELFObjOrErr = getELFObjectFile(Image);
-  if (!ELFObjOrErr) {
-    consumeError(ELFObjOrErr.takeError());
-    return false;
-  }
 
   // Search the ELF symbol using the symbol name.
-  auto SymOrErr = utils::elf::getSymbol(*ELFObjOrErr, SymName);
+  auto SymOrErr =
+      utils::elf::findSymbolInImage(Image.getMemoryBuffer(), SymName);
   if (!SymOrErr) {
     consumeError(SymOrErr.takeError());
     return false;
   }
 
-  return *SymOrErr;
+  return !SymOrErr->empty();
----------------
jhuber6 wrote:

I'll probably need to double check how that's handled in the ELF as well, I forget exactly how it's presented in the symbol form since it doesn't have a representation in ELF memory.

https://github.com/llvm/llvm-project/pull/83976


More information about the Openmp-commits mailing list