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

Ulrich Weigand via Openmp-commits openmp-commits at lists.llvm.org
Thu Mar 14 09:00:16 PDT 2024


================
@@ -138,9 +149,10 @@ getSymbolFromSysVHashTable(StringRef Name, const typename ELFT::Hash &HashTab,
 }
 
 template <class ELFT>
-static Expected<const typename ELFT::Sym *>
-getHashTableSymbol(const ELFFile<ELFT> &Elf, const typename ELFT::Shdr &Sec,
-                   StringRef Name) {
+static Expected<std::optional<ELFSymbolRef>>
+getHashTableSymbol(const ELFObjectFile<ELFT> &ELFObj,
+                   const typename ELFT::Shdr &Sec, StringRef Name) {
+  const ELFFile<ELFT> &Elf = ELFObj.getELFFile();
----------------
uweigand wrote:

We have to at some point convert a ELFT::Sym pointer into a ELFSymbolRef.  This requires access to both the symbol table (section header) containing the symbol, and the Object file wrapper (which provides the ELFObj.toSymbolRef routine that actually creates the ELFSymbolRef.  We could move the call to toSymbolRef to the caller, but there we don't have ready access to the symbol table, so we'd have to re-compute it again.  Doing it inside getHashTableSymbol seems the lesser change to me.

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


More information about the Openmp-commits mailing list