[llvm] [llvm-readobj, ELF] Support reading binary with more than PN_XNUM segments. (PR #165278)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 10 02:07:22 PDT 2026


================
@@ -4897,10 +4898,12 @@ template <class ELFT> void GNUELFDumper<ELFT>::printProgramHeaders() {
                      48 + Bias, 56 + Bias, 64 + Bias, 68 + Bias};
   uint32_t PhNum = 0;
   Expected<uint32_t> PhNumOrErr = this->Obj.getPhNum();
+  // Defer error reporting to program_headers() so that we can prevent some
+  // duplications.
   if (PhNumOrErr)
     PhNum = *PhNumOrErr;
   else
-    this->reportUniqueWarning(PhNumOrErr.takeError());
+    llvm::consumeError(PhNumOrErr.takeError());
----------------
jh7370 wrote:

Does this actually ever get hit? As far as I can tell, the only case this function is called is from the other overload of `GNUELFDumper<ELFT>::printProgramHeaders`, but that code doesn't call this function, if `getPhNum` returns an error.

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


More information about the llvm-commits mailing list