[llvm] [Object,ELF] Implement PN_XNUM extension for program headers (PR #162288)
via llvm-commits
llvm-commits at lists.llvm.org
Mon Oct 20 08:43:19 PDT 2025
================
@@ -889,7 +887,31 @@ Expected<uint64_t> ELFFile<ELFT>::getDynSymtabSize() const {
return 0;
}
-template <class ELFT> ELFFile<ELFT>::ELFFile(StringRef Object) : Buf(Object) {}
+template <class ELFT> ELFFile<ELFT>::ELFFile(StringRef Object) : Buf(Object) {
+ const Elf_Ehdr &Header = getHeader();
+ RealPhNum = Header.e_phnum;
+ RealShNum = Header.e_shnum;
+ RealShStrNdx = Header.e_shstrndx;
+ if (!Header.hasPhdrNumExtension())
+ return;
+
+ // An ELF binary may report `hasExtendedHeader` as true but not actually
----------------
aokblast wrote:
If Patch https://github.com/llvm/llvm-project/pull/162288/commits/b13b26d83141a0c2a4393c77982d5a03aa0853cb is what you expected. I would say that it fails on these testcases.
https://github.com/llvm/llvm-project/pull/162288
More information about the llvm-commits
mailing list