Search code examples
assemblyatt

How do you define a struct in at&t assembly syntax


What is the equivalent of this in at&t syntax? I can't seem to find anything via google.

struc node
        info: resd  1
        next: resd  1
 endstruc

Solution

  • There isn't anything like it supported by the GNU Assembler. The closest you can come is doing something like:

    .set note_info, 0
    .set note_next, 4
    .set note_size, 8
    

    You'd use these symbols in statements like the following:

    head:
        .space note_size
    
        movl $0, head + note_info
        mov  head + note_next, %esi
        mov  note_next(%esi), %esi