On 01.03.2024 17:32, Rich Felker wrote:
The relocation emitted is the pc-relative address based on the
beginning of the add opcode, but it needs to be based on the beginning
of the immediate operand in the add opcode.
I just moved the addition of (ind + 4)
A user encountered this bug trying to build musl libc for i386 using
tcc, where an asm source file using pc-relative addressing to load its
data was reading from the wrong address. I tracked it down to the
offset in the immediate to an add instruction, which I simplified down
to the following