Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where _bss_start is define Linux kernel source

I am going through Linux kernel source and found _bss_start C varianle in one of assembly files but could not find where it is actully defined and intialized.

It looks like _bss_start is the starting address of the bss segment but where and how it is intialized with values in kernel source ,I am looking into linux source 2.6.25.

I looked into file asm-generic/section.h where it is defined like below

 extern char _bss_start[]

but how _bss_start is defined ,is it DS register is being used to intialized it

like image 584
Amit Singh Tomar Avatar asked Mar 24 '23 06:03

Amit Singh Tomar


1 Answers

__bss_start is defined and initialized by the linker. It references the .bss section of the image, which contains statically allocated variables.

Here is a stripped down example of the linker script defining these symbols:

.bss : {
    __bss_start = .;      /*< __bss_start references this position in the file */
    *(.bss)               /*< The actual contents of the section */
    *(COMMON)             /*< The actual contents of the section */
    _ebss = . ;           /*< _ebss references this position in the file */
}
like image 195
Dark Falcon Avatar answered Mar 30 '23 00:03

Dark Falcon