further issues with x86 relocs
Jan Beulich
jbeulich@suse.com
Tue Jun 15 07:28:42 GMT 2021
H.J., Michael,
the first aspect here was, iirc, already mentioned in passing on a
relatively recent thread: Both ABIs specify e.g. GOT-or PLT-related
relocations to effectively be G(S)+A instead of G(S+A). (i386'es
GOT32 additionally bogusly says G+A-GOT, when G already is an offset
into GOT.) IMO the ABIs should be changed, but I'm not sure how
practical this is. In any event the present way of how things are
specified makes no sense with A != 0. As an observation, Arm folks
apparently noticed this oddity at some point, and the Arm64 ABI
doesn't contain such (while the Arm32 does); it simply indicates
that A is unused in respective expressions.
As it stands the assembler treats even something that is making
explicit how the addend is meant, like
mov $(sym+1)@got, %eax
the same as
mov $sym@got+1, %eax
and oddly enough also the same as
mov $1@got+sym, %eax
Even if the ABIs were not changed, it would seem to me that the
assembler would better at least warn about such uses having
undefined runtime behavior. I think this affects the majority of
the relocs handled by lex_got().
There are other issues in this area, I think, but those aren't ABI
related and only need addressing in gas.
Jan
More information about the Binutils
mailing list