Search code examples
assemblygnu-assembler

EQU directive in GAS assembly


Why does .equ directive not work in gas in this way:

.equ Mark64, 8(%rsi)

while it works in this (note: .text section, where Mark32 is located, is set to r/w in this case):

Mark32 EQU DWORD PTR [ESI + 4]

How can i make Mark64 work in GAS (.set also doesn't work)?

Thanks in advance!


Solution

  • Data section:

    MarksTable:
        .quad Mark64_1
        .quad Mark64_2
        .quad Mark64_3
    

    where Mark64_x is just a label in code section.

    And then I've just placed my MarksTable into reg:

    movq MarksTable, %rsi
    

    After all I could access Mark64_2 for instance from rsi like this:

    callq   *0x8(%rsi)