0

I have trouble understanding gap between addresses _edata_loc and __bss_start symbols. According to the linker file there should not be any gap, yet symbol __bss_start, seems to be aligned to 0x2000 byte boundary ? Am I missing something here?

I am running ARM Linux.

From system.map:

c08bcf60 D _edata
c08bcf60 D _edata_loc
c08bf000 B __bss_start
c08f98c8 B __bss_stop
c08f98c8 B _end

vmlinux.lds.S:

    _edata_loc = __data_loc + SIZEOF(.data);
   #ifdef CONFIG_HAVE_TCM
        /*I do not have TCM so neglect this part*/
   #endif
    BSS_SECTION(0, 0, 0)
    _end = .;

    STABS_DEBUG
}

BSS_SECTION is defined here: http://lxr.free-electrons.com/source/include/asm-generic/vmlinux.lds.h#L843

After compilation the generated vmlinux.lds contains :

 _edata_loc = __data_loc + SIZEOF(.data);
 . = ALIGN(0); __bss_start = .; . = ALIGN(0); .sbss : AT(ADDR(.sbss) - 0) { *(.sbss) *(.scommon) } . = ALIGN(0); .bss : AT(ADDR(.bss) - 0) { *(.bss..page_aligned) *(.dynbss) *(.bss) *(COMMON) } . = ALIGN(0); __bss_stop = .;
 _end = .;
nagla
  • 87
  • 1
  • 9
  • What does ALIGN(0) mean? Alignments are usually powers of 2, such as 1, 2, 4, 8, 16, etc. – Ian Abbott Jul 22 '16 at 16:05
  • Most probably it means no alignment needed. Note that the expansion is due to macro BSS_SECTION which we provide with 0,0,0 as arguments. – nagla Jul 24 '16 at 17:14
  • Possibly, but `BSS_SECTION(1, 1, 1)` would use `ALIGN(1)` in its expansion, which aligns to a byte boundary, effectively no alignment needed. `ALIGN(align)` seems to be a built-in function of **ld**, but the documentation for **ld** doesn't specify what an alignment of 0 means. – Ian Abbott Jul 25 '16 at 16:06

0 Answers0