[PATCH 3/6] x86: harmonize disp with imm handling
Michael Matz
matz@suse.de
Tue Jun 22 14:35:39 GMT 2021
Hello,
On Tue, 22 Jun 2021, H.J. Lu wrote:
> > All in all: I think the assembler should be entirely silent about any of
> > these literals modified by assembler operations.
>
> A 32bit displacement is signed with R_X86_64_32S. For
>
> mov disp(%rax), %eax
>
> should linker issue an error if disp == -0xffffffff?
The linker doesn't see '-0xffffffff', it sees a bit pattern that it
interprets in some way as a single number. When we write down the bit
pattern as unsigned hex, it will for instance see (in the above case when
the width is 32bit and the assembler did the obvious thing) '1' (i.e.
something that the linker can't differentiate from what was produced by
the assembler on a simple literal '1' input). There is no unary minus
operation on linker input.
Ciao,
Michael.
More information about the Binutils
mailing list