[Openmp-commits] [openmp] [libomptarget] Support BE ELF files in plugins-nextgen (PR #85246)
Joseph Huber via Openmp-commits
openmp-commits at lists.llvm.org
Thu Mar 14 08:34:44 PDT 2024
================
@@ -253,16 +272,31 @@ utils::elf::getSymbol(const ELFObjectFile<ELF64LE> &ELFObj, StringRef Name) {
auto SymTabOrErr = ELFObj.getELFFile().getSection(Sec.getIndex());
if (!SymTabOrErr)
return SymTabOrErr.takeError();
- return getSymTableSymbol<ELF64LE>(ELFObj.getELFFile(), **SymTabOrErr, Name);
+ return getSymTableSymbol<ELFT>(ELFObj, **SymTabOrErr, Name);
}
- return nullptr;
+ return std::nullopt;
}
-Expected<const void *> utils::elf::getSymbolAddress(
- const object::ELFObjectFile<object::ELF64LE> &ELFObj,
- const object::ELF64LE::Sym &Symbol) {
- const ELFFile<ELF64LE> &ELFFile = ELFObj.getELFFile();
+Expected<std::optional<ELFSymbolRef>>
+utils::elf::getSymbol(const ObjectFile &Obj, StringRef Name) {
+ if (const ELF64LEObjectFile *ELFObj = dyn_cast<ELF64LEObjectFile>(&Obj))
+ return getSymbolImpl(*ELFObj, Name);
+ if (const ELF64BEObjectFile *ELFObj = dyn_cast<ELF64BEObjectFile>(&Obj))
+ return getSymbolImpl(*ELFObj, Name);
----------------
jhuber6 wrote:
Can you not just do `getELFFile` here like before?
https://github.com/llvm/llvm-project/pull/85246
More information about the Openmp-commits
mailing list