[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
Tue Mar 24 02:56:56 PDT 2026
================
----------------
jh7370 wrote:
This test isn't tight enough. There are a couple of cases it doesn't cover, due to the nature of FileCheck.
1) If there is a program header in the output before or in between the PT_LOAD headers, it'll be skipped, because the `Type: PT_LOAD` line will jump to the first found instance (which could be after the start of the next ProgramHeader for example) and match that. One way to resolve this would be to use CHECK-SAME to show the PT_LOAD is on the same line as the Type field:
```
# VALID-LLVM: Type:
# VALID-LLVM-SAME: PT_LOAD
```
2) This set of tests doesn't show that there are no more program headers after the ones being checked for, so there could be all sorts of garbage output afterwards. The best way to check this would probably be `# VALID-LLVM-NOT: ProgramHeader {` after the last one you intend to check.
The GNU output has similar issues. I think the fix there is different: you probably just want to use CHECK-NEXT to check each line (including the column header line), with a final CHECK-EMPTY to show the end of the program header table has been reached:
```
# VALID-GNU: Program Headers:
# VALID-GNU-NEXT: Type
# VALID-GNU-NEXT: LOAD
# VALID-GNU-NEXT: LOAD
# VALID-GNU-EMPTY:
```
https://github.com/llvm/llvm-project/pull/165278
More information about the llvm-commits
mailing list