Do .bss section zero initialized variables occupy space in elf file?

后端 未结 4 2118
有刺的猬
有刺的猬 2020-12-04 08:44

If I understand correctly, the .bss section in ELF files is used to allocate space for zero-initialized variables. Our tool chain produces ELF files, hence my q

4条回答
  •  独厮守ぢ
    2020-12-04 09:19

    That is correct, .bss is not present physically in the file, rather just the information about its size is present for the dynamic loader to allocate the .bss section for the application program. As thumb rule only LOAD, TLS Segment gets the memory for the application program, rest are used for dynamic loader.

    About static executable file, bss sections is also given space in the execuatble

    Embedded application where there is no loader this is common.

    Suman

提交回复
热议问题