Wikipedia mentions that .bss
section occupies no actual space in the object file, and I indeed find a .bss
entry with size 0 in the objdump
information. So the question is what's the necessity of such an empty section existing in an object file?
Why can't .bss
only being added in the executable file rather in both the .o
and a.out
file, just as .rel
only appears in the object files.
Update: I think I misunderstood the process of relocating. I first thought the executable files are generated by the linker from scratch and it turns to be wrong after I saw the comment of Downvoters.