[PATCH] elf: Handle the section flag 'o' linked to special sections

Jan Beulich jbeulich@suse.com
Mon Jan 12 16:59:46 GMT 2026


On 11.01.2026 05:03, H.J. Lu wrote:
> Call _bfd_elf_section_from_bfd_section to get the sh_link value from
> the section flag 'o' directive, which may point to special sections,
> like SHN_ABS or SHN_COMM.  Update readelf to print the special section
> names in the sh_link field.

In principle okay, but I have a question first:

> binutils/
> 
> PR gas/33744
> * readelf.c (special_defined_section_index): New.
> (get_32bit_section_headers): Don't warn special section indexes
> in the sh_link field.
> (get_64bit_section_headers): Likewise.

In these two you adjust (identical) conditions involving
"internal->sh_link > num". However, here ...

> (process_section_headers): Print special section names.

... it is "section->sh_link >= filedata->file_header.e_shnum". The latter
looks correct to me while the former doesn't until switched to also
using >= . While one could argue this is an unrelated change, imo it
would better be done while fiddling with this anyway. Thoughts?

Jan


More information about the Binutils mailing list