plan9front/sys
Lennart Jablonka d73932922b 6l: relocate operands with REX correctly
If rexflag is non-zero, it's used to insert an REX prefix byte in
asmins.  That's a while after put4 and put8 take note of the address
of a relocation.  So let them be aware that if rexflag is non-zero,
the relocation's address is to be higher.

Reproduction:

The program

	int global;
	int f(void){return global;}

is compiled to the IR assembly

	TEXT	f+0(SB),0,$0
	MOVL	global+0(SB),AX
	RET	,
	RET	,
	GLOBL	global+0(SB),$4
	END	,

and (using 6l -u) the machine code

	8b042508 000000c3

The relocation (see a.out(6)) correctly applies to the 08 00 00 00.
The program

	int *global;
	int *f(void){return global;}

is compiled to

	TEXT	f+0(SB),0,$0
	MOVQ	global+0(SB),AX
	RET	,
	RET	,
	GLOBL	global+0(SB),$8
	END	,

and the machine code

	488b0425 10000000 c3020000 00000000

What's different is the added REX prefix 0x48, but the relocation is
done at the same place in the binary, which now is 25 10 00 00 instead
of the correct 10 00 00 00.
2024-12-29 13:55:02 +00:00
..
doc /sys/doc/fs: don't make fs.html by default 2025-01-05 17:49:10 +00:00
games/lib /sys/games/lib/fortunes: redaction day 2024-08-02 03:06:08 +00:00
include libmemdraw: change openmemsubfont() to accept rune minimum as argument 2025-01-03 00:51:43 +00:00
lib /sys/lib/dist/ndb/common: add git and gits 2024-11-07 00:40:35 +00:00
man gefs(8): fix indent of empty snapshot paragraph 2025-01-08 19:36:17 +00:00
src 6l: relocate operands with REX correctly 2024-12-29 13:55:02 +00:00