1 year ago

#125434

test-img

xiver77

Syntax for indirect jump in GAS (Intel syntax): double brackets and/or OFFSET as part of the addressing mode?

For an indirect jump to the address stored in L + 8 in 64-bit mode,

nasm accepts,

jmp [L + 8]
jmp qword [L + 8]

GNU as accepts,

jmp [L + 8]
jmp qword ptr [L + 8]

and also,

jmp [[L + 8]]
jmp [qword ptr [L + 8]]

even more,

jmp qword ptr [offset L + 8]
jmp [qword ptr [offset L + 8]]

but not,

jmp [offset L + 8]
jmp [[offset L + 8]]

I'm very confused about what effects the brackets, qword ptr and offset are having in those statements.

I know the basics that GAS treats L as same as [L], and you have to put offset to use L as a constant memory address, but this doesn't explain why sometimes it's okay to omit offset and sometimes you must omit offset, and why it is okay to put additional brackets.

Could you clarify the syntax used for indirect jumps in GAS Intel syntax?

assembly

x86

gnu-assembler

addressing-mode

intel-syntax

0 Answers

Your Answer

Accepted video resources