Converting [symbol + constant] Intel syntax addressing mode to AT&T syntax?

前端 未结 2 1614
Happy的楠姐
Happy的楠姐 2021-01-28 10:13

I just cant figure out how to add an offset to my destination when moving a value, specifically in Intel syntax I have:

MOV   [gdtr + 2], EAX

a

2条回答
  •  死守一世寂寞
    2021-01-28 11:13

    Simply write

    movl %eax, gdtr+2
    

    Base-offset addressing only works when the offset is a register. There's no point in having an addressing mode to add two constants together; the way this works (regardless of syntax) is that the assembler / linker resolve symbol+constant into a a single number for the displacement field of the instruction encoding.

提交回复
热议问题