程式語言 - GNU - Struct



main.c

#include <stdint.h>

struct _mydata {
    uint8_t i0;
    uint16_t i1;
    uint32_t i2;
} mydata = {0};

int main(int argc, char **argv)
{
    return 0;
}

IDA Pro


main.s

    .global _start

    .equ _mydata.i0, 1
    .equ _mydata.i1, 2
    .equ _mydata.i2, 4

    .struct 0
    _mydata_start:
        i0: .struct . + _mydata.i0
        i1: .struct . + _mydata.i1
        i2: .struct . + _mydata.i2
    _mydata_end:
    _mydata_len = _mydata_end - _mydata_start

    .data
mydata: .space _mydata_len

    .text
_start:
    mov $0, %ebx
    mov $1, %eax
    int $0x80

IDA Pro