ASM: Loading address of label truncates to 32 bits on x64
claptrap
clap at trap.com
Sun Nov 10 00:47:07 UTC 2024
```d
asm
{
mov EAX,idx;
shl EAX,4;
lea RCX,LOOKUP;
jmp [RCX+RAX];
LOOKUP:
lea R9,CASE0;
jmp ENDLOOKUP;
align 16;
lea R9,CASE1;
jmp ENDLOOKUP;
align 16;
ENDLOOKUP:
}
00007FF760D244A7 mov eax,dword ptr [rbp-48h]
00007FF760D244AA shl eax,4
00007FF760D244AD lea rcx,[60D244B8h]
00007FF760D244B5 jmp qword ptr [rcx+rax]
00007FF760D244B8 lea r9,[60D24572h]
00007FF760D244C0 jmp 00007FF760D244E0
00007FF760D244C2 nop word ptr cs:[rax+rax]
00007FF760D244D0 lea r9,[60D2455Bh]
00007FF760D244D8 jmp 00007FF760D244E0
```
All the "lea REG,label" instructions are missing the top 32 bits
of the actual address.
Looks like a bug to me as it works OK on DMD. At least I compiled
a small test and DMD prints out a 64 bit address
More information about the digitalmars-d-ldc
mailing list