Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MASM64 jump table

192 views
Skip to first unread message

Andrew Jarvis

unread,
Apr 16, 2007, 2:05:22 PM4/16/07
to
My 32 bit assembler code contained the following:

jmp [dispatch+ecx*4]

dispatch:
DD label1
DD label2

To assemble with MASM64, I have changed this to:

jmp [dispatch+rcx*8]

dispatch:
DQ label1
DQ label2

The linker produces "error LNK2017: 'ADDR32' relocation to 'dispatch'
invalid without /LARGEADDRESSAWARE:NO"

Is it possible to set up a jump table like this using EM64T?

Regards,
Andrew


Andrew Jarvis

unread,
Apr 17, 2007, 5:28:50 AM4/17/07
to
I compiled a C switch statement. The generated code was similar to:

EXTRN __ImageBase:BYTE

lea rax,OFFSET __ImageBase
mov ecx,DWORD PTR dispatch[rax+rcx*4]
add rcx,rax
jmp rcx

dispatch:
DD label1
DD label2

However, when I used this code I still got linker "error LNK2017: 'ADDR32'
relocation to 'dispatch' invalid without /LARGEADDRESSAWARE:NO".

"Andrew Jarvis" <someone@somewhere> wrote in message
news:%231ZVFHF...@TK2MSFTNGP06.phx.gbl...

maz...@centrum.cz

unread,
Apr 23, 2007, 5:33:55 AM4/23/07
to
> > My 32 bit assembler code contained the following:
> >
> > jmp [dispatch+ecx*4]
> >
> > dispatch:
> > DD label1
> > DD label2
> >
> > To assemble with MASM64, I have changed this to:
> >
> > jmp [dispatch+rcx*8]
> >
> > dispatch:
> > DQ label1
> > DQ label2
> >
> > The linker produces "error LNK2017: 'ADDR32' relocation to 'dispatch'
> > invalid without /LARGEADDRESSAWARE:NO"
> >
> > Is it possible to set up a jump table like this using EM64T?
> >
> > Regards,
> > Andrew

Given this source:

.CODE
main PROC
jmp [dispatch+rcx*8]

nop
label1:
nop
label2:
nop

dispatch:
DQ label1
DQ label2

main ENDP

END

and using ML64 nad LINK 8.00.50727.42, I can assemble and link it
without any errors.

0 new messages