Purpose of .note.GNU-stack

Peng Yu pengyu.ut@gmail.com
Wed Apr 21 19:52:34 GMT 2021


Hi,

I see that there is nothing in .note.GNU-stack. What is
.note.GNU-stack supposed to do if there is nothing in it? Thanks.

$ readelf -n a.o
$ readelf -SW a.o
...
  [Nr] Name              Type            Address          Off    Size
 ES Flg Lk Inf Al
...
  [ 7] .note.GNU-stack   PROGBITS        0000000000000000 0000ab
000000 00      0   0  1

The assembly code is here.
$ as -o a.o a.s

    .file    "a.c"
    .text
    .globl    s
    .section    .rodata
    .align 8
    .type    s, @object
    .size    s, 14
s:
    .string    "Hello World2!"
.LC0:
    .string    "Hello World!"
    .text
    .globl    main
    .type    main, @function
main:
.LFB0:
    .cfi_startproc
    pushq    %rbp
    .cfi_def_cfa_offset 16
    .cfi_offset 6, -16
    movq    %rsp, %rbp
    .cfi_def_cfa_register 6
    leaq    .LC0(%rip), %rdi
    call    puts@PLT
    leaq    s(%rip), %rdi
    call    puts@PLT
    movl    $0, %eax
    popq    %rbp
    .cfi_def_cfa 7, 8
    ret
    .cfi_endproc
.LFE0:
    .size    main, .-main
    .ident    "GCC: (Debian 10.2.1-6) 10.2.1 20210110"
    .section    .note.GNU-stack,"",@progbits

-- 
Regards,
Peng


More information about the Binutils mailing list