[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:51:25 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:

Just make it `std::optional` if it's not meant to fail.

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


More information about the Openmp-commits mailing list