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

Joseph Huber via Openmp-commits openmp-commits at lists.llvm.org
Tue Mar 5 20:42:20 PST 2024


================
@@ -283,3 +297,45 @@ Expected<const void *> utils::elf::getSymbolAddress(
 
   return ELFFile.base() + Offset;
 }
+
+template <class ELFT>
+static Expected<StringRef>
+findSymbolInImageImpl(const object::ELFObjectFile<ELFT> &ELFObj,
+                      StringRef Name) {
+  // Search for the symbol by name.
+  auto SymOrErr = getSymbol(ELFObj, Name);
+  if (!SymOrErr)
+    return SymOrErr.takeError();
+  // If symbol not found, return an empty StringRef.
+  if (!*SymOrErr)
+    return StringRef();
----------------
jhuber6 wrote:

Didn't we used to have a separate boolean check for this? I suppose it works if we want to encode that error logic at the call site.

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


More information about the Openmp-commits mailing list