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

James Henderson via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Mar 4 02:41:38 PST 2026


================
@@ -222,14 +224,32 @@ Sections:
 ## Check we don't dump anything except the file header when the section header table can't be read.
 
 # RUN: not llvm-readobj -a %t.invalid1 2>&1 \
-# RUN:  | FileCheck %s -DFILE=%t.invalid1 -DSECHDRCOUNT=8192 -DSECHDRSTRTABINDEX=12288 --check-prefix=INVALID-LLVM
+# RUN:  | FileCheck %s -DFILE=%t.invalid1 -DSECHDROFF=0x1000 -DPHDRCOUNT="0" -DSECHDRCOUNT=8192 -DSECHDRSTRTABINDEX=12288 --check-prefix=INVALID-LLVM
 # RUN: not llvm-readelf -a %t.invalid1 2>&1 \
-# RUN:  | FileCheck %s -DFILE=%t.invalid1 -DSECHDRCOUNT=8192 -DSECHDRSTRTABINDEX=12288 --check-prefix=INVALID-GNU
+# RUN:  | FileCheck %s -DFILE=%t.invalid1 -DSECHDROFF=4096 -DPHDRCOUNT="0" -DSECHDRCOUNT=8192 -DSECHDRSTRTABINDEX=12288 --check-prefix=INVALID-GNU
 
 ## Check what we print when e_shnum == 0, e_shstrndx == SHN_XINDEX and the section header table can't be read.
+## TODO: We should not report LLVM-BAD-PHDR and GNU-BAD-PHDR in the future since these are duplicate errors.
----------------
jh7370 wrote:

If we no longer get two warnings for the same issue, there's no need for this TODO any longer, is there? The problem before was that we were getting two warnings for the same test case, I believe.

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


More information about the llvm-branch-commits mailing list