[cfe-dev] .bss section in elf file

TheMask lol.themask at gmail.com
Fri Apr 4 05:23:37 PDT 2014


If I understand corretly, by creating a section of .bss type (as below code
example) the write/read area of the .bss section is from section's offset
in the file to N and in this case phdr.p_memsz gets incremented by N bytes
and it's up to operating system/kernel zero this memory area. Is my
intepretation right?

<i>    Elf32_Phdr phdr;
    // ...
    phdr.p_memsiz = somevalue;
    Elf32_Shdr sec;
    // ...
    sec.sh_name   = bss_name;
    sec.sh_type   = SHT_nobits;
    sec.sh_flags  = SHF_alloc + SHF_write;
    sec.sh_size = N;
    phdr.p_memsiz += N;

</i>




--
View this message in context: http://clang-developers.42468.n3.nabble.com/bss-section-in-elf-file-tp4038737.html
Sent from the Clang Developers mailing list archive at Nabble.com.



More information about the cfe-dev mailing list