================
@@ -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,"
----------------
jh7370 wrote:
I'd expect to see test coverage for this behaviour with `>= PN_XNUM` program
headers. Also test coverage for this code executing when there's a problem with
reading the program header count.
https://github.com/llvm/llvm-project/pull/165278
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits