Forum: ARM programming with GCC/GNU tools Bss and data section

Author: Armand Iostrym (iostrym)
Posted on:

Rate this post
0 useful
not useful
Hi everyone,

I compile a small C programm to test if initialized data will be put in
data section and non initialized data in bss section.

int a=5;

int b;
int c;
int d;

int titi()

int i;
int f=8;


And I'm surprised to see that initialized datas were put in data section
after the compilation step (I can see it in toto.s) but even after
linking, there is still no bss section.
I'm using gcc and I notice that with

arm-elf-objdump -h toto.elf

I can see there is a .bss section and a .stack section but I can't see
it with

arm-elf-objdump -D toto.elf

I see only .text and .data section. Maybe is it because there is no
assembler inside it but I remember that with -D i was able to see .data
section even there is nothing inside it.

With nm toto.elf

I can see that there is symbol b,c,d with B letter so it seems these
value are inside BSS section.

Thanks for your help

Author: Stefan (Guest)
Posted on:

Rate this post
0 useful
not useful
The .bss section of an object file contains no valid data, so it isn't
meaningful to disassemble this section. Think of the .bss section entry
as a information for the linker "object abc in object file xyz needs klm
bytes memory" only.

You can use objdump with option -h (aka --section-header or --header) to
display summary information from the section headers of the object file.


Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]

Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.