[PATCH v2] elf: Handle the section flag 'o' linked to special sections
Jan Beulich
jbeulich@suse.com
Tue Jan 13 07:38:38 GMT 2026
On 13.01.2026 00:55, H.J. Lu wrote:
> On Tue, Jan 13, 2026 at 12:59 AM Jan Beulich <jbeulich@suse.com> wrote:
>>
>> 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?
>
> Good point. Here is the v2 patch to replace "internal->sh_link > num"
> with "internal->sh_link >= num".
Thanks, and (as already implied) okay.
Jan
More information about the Binutils
mailing list