[PATCH] readelf: Warn zero-sized relocation sections
Jan Beulich
jbeulich@suse.com
Tue Apr 14 12:42:04 GMT 2020
On 14.04.2020 14:25, H.J. Lu via Binutils wrote:
> Older linkers may fail with zero-sized relocation section in section
> group.
>
> PR ld/25767
> * readelf.c (process_section_headers): Warn zero-sized
> relocation sections.
Zero-sized sections of whatever kind are perfectly fine in ELF. I
see no reason why one would want to see a warning for such by
default.
Jan
> ---
> binutils/readelf.c | 14 ++++++++++++--
> 1 file changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/binutils/readelf.c b/binutils/readelf.c
> index cd456b0290..535d47a58e 100644
> --- a/binutils/readelf.c
> +++ b/binutils/readelf.c
> @@ -6315,9 +6315,19 @@ process_section_headers (Filedata * filedata)
> else if (section->sh_type == SHT_GROUP)
> CHECK_ENTSIZE_VALUES (section, i, GRP_ENTRY_SIZE, GRP_ENTRY_SIZE);
> else if (section->sh_type == SHT_REL)
> - CHECK_ENTSIZE (section, i, Rel);
> + {
> + CHECK_ENTSIZE (section, i, Rel);
> + if (section->sh_size == 0)
> + warn (_("Section '%s': zero-sized relocation section\n"),
> + name);
> + }
> else if (section->sh_type == SHT_RELA)
> - CHECK_ENTSIZE (section, i, Rela);
> + {
> + CHECK_ENTSIZE (section, i, Rela);
> + if (section->sh_size == 0)
> + warn (_("Section '%s': zero-sized relocation section\n"),
> + name);
> + }
> else if ((do_debugging || do_debug_info || do_debug_abbrevs
> || do_debug_lines || do_debug_pubnames || do_debug_pubtypes
> || do_debug_aranges || do_debug_frames || do_debug_macinfo
>
More information about the Binutils
mailing list