[PATCH 2/2] readelf: Use section names for displaying RELR relocs
Nick Clifton
nickc@redhat.com
Wed May 29 12:32:52 GMT 2024
Hi Szabolcs,
>> 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?
I think so. The only case where there would be confusion is if the
file has contains a section and a symbol of the same name, but different
addresses. Which to my mind is just asking for trouble, and would
probably cause confusion whenever those symbols are displayed.
> 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?
Yes that is fine - do not worry about it.
I am sure that if needed we can tweak the symbol selection heuristic
with some later patches, once people have started using readelf's new
RELR display.
Cheers
Nick
More information about the Binutils
mailing list