[Openmp-commits] [openmp] [libomptarget] Support BE ELF files in plugins-nextgen (PR #83976)
Ulrich Weigand via Openmp-commits
openmp-commits at lists.llvm.org
Wed Mar 6 07:12:47 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();
----------------
uweigand wrote:
Yes, the point is that the check needs to be done at the call site. One caller wants to check whether the symbol exists or not (so non-existence should not be an error *here*), for the other caller non-existence *is* an error, so that error is (still) generated at the call site.
https://github.com/llvm/llvm-project/pull/83976
More information about the Openmp-commits
mailing list