[PATCH] readelf: Warn zero-sized relocation sections
H.J. Lu
hjl.tools@gmail.com
Tue Apr 14 13:54:22 GMT 2020
On Tue, Apr 14, 2020 at 6:38 AM Jan Beulich <jbeulich@suse.com> wrote:
>
> On 14.04.2020 15:30, H.J. Lu wrote:
> > On Tue, Apr 14, 2020 at 6:25 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>
> >> On 14.04.2020 15:03, H.J. Lu wrote:
> >>> On Tue, Apr 14, 2020 at 5:42 AM Jan Beulich <jbeulich@suse.com> wrote:
> >>>>
> >>>> 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.
> >>>
> >>> Linkers older than 2.35 may fail with
> >>>
> >>> ./ld: BFD (GNU Binutils) 2.34.50.20200402 assertion fail
> >>> /export/gnu/import/git/gitlab/x86-binutils/bfd/elf.c:3652
> >>
> >> Which is a bug, yes, but imo no reason to clutter readelf output.
> >>
> >
> > When such linker failures happen, this is useful to identify why.
>
> And hence an option to enable such a warning would seem reasonable,
> but not making this default behavior.
>
The idea is that compilers shouldn't generate such objects so that
readelf won't output this warning and older linkers work OK. Otherwise,
users will have a very hard time to figure out why linker fails.
--
H.J.
More information about the Binutils
mailing list