[Mirror] Some kind of OS: git://git.9front.org/plan9front/plan9front
Find a file
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
386 ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
68000 add signed fixed size integer typedefs 2018-05-12 19:19:52 +02:00
68020 ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
acme libc, libthread, ape: mark exit functions as _Noreturn and clean up new warnings 2024-01-28 03:36:41 +00:00
adm/timezone timezones: Add Indonesia (thanks AlfredPros) 2024-10-17 06:04:51 +00:00
amd64 libc: change usize to 64-bit for amd64 and arm64, make memory(2) functions use usize 2021-07-25 15:54:22 +00:00
arm ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
arm64 libc: change usize to 64-bit for amd64 and arm64, make memory(2) functions use usize 2021-07-25 15:54:22 +00:00
lib auth/factotum: mount factotum onto /mnt/factotum instead of /mnt by default 2024-11-23 16:05:11 +00:00
mips ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
power ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
power64 power64: refactor va_arg in u.h to fix warnings 2024-05-12 00:26:37 +00:00
rc configfs: adjust phrasing on file system state/usecases 2025-01-05 23:35:20 +00:00
sparc ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
sparc64 ape: sync flaot.h macros with u.h 2021-02-08 15:45:11 -08:00
spim /spim/include/ape/ureg.h: fixed missing ifndef 2023-03-07 04:26:34 +00:00
sys 6l: relocate operands with REX correctly 2024-12-29 13:55:02 +00:00