[PATCH] readelf: objdump: sframe: fix dumping with section name
Jan Beulich
jbeulich@suse.com
Tue Jul 22 07:41:34 GMT 2025
On 20.07.2025 07:34, Indu Bhagat via Binutils wrote:
> --- a/binutils/objdump.c
> +++ b/binutils/objdump.c
> @@ -4495,6 +4495,8 @@ dump_dwarf_section (bfd *abfd, asection *section,
>
> if (startswith (name, ".gnu.linkonce.wi."))
> match = ".debug_info";
> + else if (elf_section_type (section) == SHT_GNU_SFRAME)
> + match = ".sframe";
> else
> match = name;
>
> @@ -4999,6 +5001,12 @@ dump_sframe_section (bfd *abfd, const char *sect_name, bool is_mainfile)
> printf (_("No %s section present\n\n"), sanitize_string (sect_name));
> return;
> }
> + else if (elf_section_type (sec) != SHT_GNU_SFRAME)
As mentioned before, can we please get away without "else" in such cases?
> + {
> + printf (_("Section %s does not contain SFrame data\n\n"),
> + sanitize_string (sect_name));
Why "does"? When created with 2.44 it would be a PROGBITS section, so
the message would end up being wrong. Unless there's some magic somewhere
that I'm unaware of.
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -17493,6 +17493,7 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * fileda
>
> if (streq (sec->uncompressed_name, name)
> || (id == line && startswith (name, ".debug_line."))
> + || (id == sframe && section->sh_type == SHT_GNU_SFRAME)
Using id is correct here; it escapes me why ...
> @@ -17502,6 +17503,8 @@ display_debug_section (int shndx, Elf_Internal_Shdr * section, Filedata * fileda
>
> if (i == line && startswith (name, ".debug_line."))
... i is used here instead, and hence I'd like to ask that you use ...
> sec->name = name;
> + else if (i == sframe && section->sh_type == SHT_GNU_SFRAME)
... id here.
> + sec->name = name;
> else if (streq (sec->uncompressed_name, name))
> sec->name = sec->uncompressed_name;
> else
Overall, doesn't this change mean that readelf (unlike objdump) would
properly display multiple GNU_SFRAME sections of arbitrary names?
Jan
More information about the Binutils
mailing list