12

Test is on Linux 32bit.

I use this command to get the context of .text .rodata and .data section:

objdump -s -j .text elf_binary
objdump -s -j .rodata elf_binary
objdump -s -j .data elf_binary

But basically when I tried to use this to get the content of .bss section, I always get the error shown below:

objdump -s -j .bss elf_binary

objdump: section '.bss' mentioned in a -j option, but not found in any input file

Basically how can I get the content of .bss section from ELF binary?

2 Answers 2

21

The .bss has no content. It's simply a tip to the loader to preallocate some space when starting the program. It will be all 0s at the execution and won't hold any useful information until the program writes to it. After that, you can use a debugger to dump the memory and explore its content.

Check the Wikipedia page for more information.

6

The .bss block started by symbol (also called Uninitialized data segment - bss is an old assembly instruction on an ancient IBM chip) section is supposed to contain global variables and static variables uninitialized or initialized to 0 or NULL. The .bss section is usually non existing until your program starts executing, this is why you can't retrieve its content statically. It is fairly important to note that this section helps reduce the program's size & makes it quicker to load.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.