[PATCH] readelf: Display and return true for empty note section/segment
Jan Beulich
jbeulich@suse.com
Wed Jan 14 08:40:41 GMT 2026
On 14.01.2026 02:02, H.J. Lu wrote:
> Change readelf to display and return true for empty note section and
> segment.
I don't mind this part, but I also don't view it as strictly necessary. The
patch suggested in [1] would imo do.
> Add a linker test to verify that empty note section is discarded.
This part, otoh, I disagree with: Rather than adding a test to verify this
behavior, shouldn't it be corrected? Apart from you, everyone else now
looks to converge to empty note sections being legitimate. If the linker
discards them blindly (there may want / need to be exceptions, like for
.note.GNU-stack), that may need changing then.
> binutils/
>
> PR ld/33780
> * readelf.c (process_notes_at): Display and return true for empty
> note section and segment.
>
> gas/
>
> PR ld/33780
> * testsuite/gas/elf/elf.exp: Run empty-note.
> * testsuite/gas/elf/empty-note.d: New file.
> * testsuite/gas/elf/empty-note.s: Likewise.
>
> ld/
>
> PR ld/33780
> * testsuite/ld-elf/empty-note.d: New file.
As to this file's use of #failif: I don't think it can be used like this,
i.e. with multiple expectation lines different from "#...". Aiui you want
the test to fail if either line shows up, yet the effect would be that it
would fail only if both show up.
Jan
[1] https://sourceware.org/pipermail/binutils/2026-January/147115.html
More information about the Binutils
mailing list