[llvm] [Object][ELF] Fix section header zero check (PR #181796)

via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 17 02:50:44 PST 2026


github-actions[bot] wrote:

<!--PREMERGE ADVISOR COMMENT: Windows-->
# :window: Windows x64 Test Results

* 130972 tests passed
* 2941 tests skipped
* 1 test failed

## Failed Tests
(click on a test name to see its output)

### LLVM
<details>
<summary>LLVM.tools/llvm-readobj/ELF/many-sections.s</summary>

```
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 9
c:\_work\llvm-project\llvm-project\build\bin\yaml2obj.exe --docnum=1 C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s -o C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\yaml2obj.exe' --docnum=1 'C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s' -o 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1'
# note: command had no output on stdout or stderr
# RUN: at line 10
c:\_work\llvm-project\llvm-project\build\bin\llvm-readelf.exe --file-headers -S C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s --check-prefix=GNU1
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-readelf.exe' --file-headers -S 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s' --check-prefix=GNU1
# note: command had no output on stdout or stderr
# RUN: at line 15
c:\_work\llvm-project\llvm-project\build\bin\llvm-readobj.exe --file-headers C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1 | c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s --check-prefix=LLVM1
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-readobj.exe' --file-headers 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp1'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s' --check-prefix=LLVM1
# note: command had no output on stdout or stderr
# RUN: at line 34
c:\_work\llvm-project\llvm-project\build\bin\yaml2obj.exe --docnum=2 C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s -o C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\yaml2obj.exe' --docnum=2 'C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s' -o 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2'
# note: command had no output on stdout or stderr
# RUN: at line 36
c:\_work\llvm-project\llvm-project\build\bin\llvm-readelf.exe --file-headers --sections C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2 2>&1 |    c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s -DFILE=C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2 --check-prefix=GNU2
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\llvm-readelf.exe' --file-headers --sections 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2'
# note: command had no output on stdout or stderr
# executed command: 'c:\_work\llvm-project\llvm-project\build\bin\filecheck.exe' 'C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s' '-DFILE=C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2' --check-prefix=GNU2
# .---command stderr------------
# | C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s:45:14: error: GNU2-NEXT: expected string not found in input
# | # GNU2-NEXT: warning: '[[FILE]]': e_shstrndx == SHN_XINDEX, but the section header table is empty
# |              ^
# | <stdin>:23:36: note: scanning from here
# | There are no sections in this file.
# |                                    ^
# | <stdin>:23:36: note: with "FILE" equal to "C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2"
# | There are no sections in this file.
# |                                    ^
# | 
# | Input file: <stdin>
# | Check file: C:\_work\llvm-project\llvm-project\llvm\test\tools\llvm-readobj\ELF\many-sections.s
# | 
# | -dump-input=help explains the following input dump.
# | 
# | Input was:
# | <<<<<<
# |            .
# |            .
# |            .
# |           18:  Number of program headers: 0 
# |           19:  Size of section headers: 64 (bytes) 
# |           20:  Number of section headers: 0 
# |           21:  Section header string table index: 65535 (corrupt: out of range) 
# |           22:  
# |           23: There are no sections in this file. 
# | next:45'0                                        X error: no match found
# | next:45'1                                          with "FILE" equal to "C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2"
# |           24: c:\_work\llvm-project\llvm-project\build\bin\llvm-readelf.exe: warning: 'C:\_work\llvm-project\llvm-project\build\test\tools\llvm-readobj\ELF\Output\many-sections.s.tmp2': invalid section index: 0 
# | next:45'0     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# | >>>>>>
# `-----------------------------
# error: command failed with exit status: 1

--

```
</details>

If these failures are unrelated to your changes (for example tests are broken or flaky at HEAD), please open an issue at https://github.com/llvm/llvm-project/issues and add the `infrastructure` label.

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


More information about the llvm-commits mailing list