[PATCH 2/2] readelf: Use section names for displaying RELR relocs
Szabolcs Nagy
szabolcs.nagy@arm.com
Wed May 29 11:06:52 GMT 2024
The 05/29/2024 10:56, Nick Clifton wrote:
> Hi Szabolcs,
>
> > In some cases using section names instead of symbol names for
> > displaying an address is more useful.
> >
> > If the symbol falls outside the section where the address is
> > then likely it is not useful to display the address relative to.
> >
> > And if symbols are stripped from a binary then printing the
> > section that contains the address is more useful than printing
> > <no sym>.
>
> That makes sense. I just have one question:
>
> > + /* Only display section names that follow the '.' convention. */
> > + && section_name (filedata, sec)[0] == '.')
>
> Why have this restriction ? What is wrong with section names that
> do not follow the convention ?
the reason was that with 'foo + 0x1234' one cannot tell
if foo is a symbol or section name and i thought if we
only allow .section that avoids some potential ambiguity,
but i don't know if this matters in practice.
should i drop this check?
another issue i just noticed is that section addresses can
overlap, e.g. .tbss and .init_array overlap in libc.so.6
and find_section_by_address returns .tbss even though that
is not the section being relocated, but this seems tricky
to fix.
is that acceptable?
More information about the Binutils
mailing list