The variable name defined in .bss section can not be found in gdb

Viewed 4006

I'm trying a simple assembly code:

.section .data
output:
    .ascii "The processor Vendor ID is 'xxxxxxxxxxxx'\n"
.section .bss
    .lcomm buffer, 12
.section .text
.code32
.globl _start
_start:
    movl $0, %eax
    cpuid
    movl $output, %edi

In .bss section I defined a variable named with "buffer"

When I try to get its address/value in gdb, it just prints:

(gdb) p $buffer
$1 = void

Using objdump, I found the name is not in ELF file, so how to keep such name information when running as and ld? Thank you!

3 Answers
Related