[llvm-branch-commits] [llvm] [llvm-readobj, ELF] Support reading binary with more than PN_XNUM segments. (PR #165278)
via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Fri Feb 27 08:12:08 PST 2026
================
@@ -4853,10 +4873,17 @@ template <class ELFT> void GNUELFDumper<ELFT>::printProgramHeaders() {
const Elf_Ehdr &Header = this->Obj.getHeader();
Field Fields[8] = {2, 17, 26, 37 + Bias,
48 + Bias, 56 + Bias, 64 + Bias, 68 + Bias};
+ uint32_t PhNum = 0;
+ Expected<uint32_t> PhNumOrErr = this->Obj.getPhNum();
+ if (PhNumOrErr)
+ PhNum = *PhNumOrErr;
+ else
+ this->reportUniqueWarning(PhNumOrErr.takeError());
+
OS << "\nElf file type is "
<< enumToString(Header.e_type, ArrayRef(ElfObjectFileType)) << "\n"
<< "Entry point " << format_hex(Header.e_entry, 3) << "\n"
- << "There are " << Header.e_phnum << " program headers,"
+ << "There are " << PhNum << " program headers,"
----------------
aokblast wrote:
Covered by adding a --program-headers in INVALID-LLVM and INVALID-GNU tests:). Thanks!
https://github.com/llvm/llvm-project/pull/165278
More information about the llvm-branch-commits
mailing list