2
votes
    .file   "test.c"
    .globl  a1
    .data
    .align 4
    .type   a1, @object
    .size   a1, 4
a1:
    .long   111
    .globl  a2
    .align 4
    .type   a2, @object
    .size   a2, 8
a2:
    .long   1
    .long   2
    .text
    .globl  main
    .type   main, @function
main:
    ...
    ...

From the context, I think it should be:

    .data
    .globl  a1

Why does GCC put .data behind .globl ?

1

1 Answers

4
votes

Why does GCC put .data behind .globl ?

It doesn't matter. The .globl directive only tells the assembler that the symbol should be global (visible to the linker). What matters is that the label itself (i.e. the line a1:) is placed after .data.