BSS, etc..
Processes each comprise:
- "Text" (where executable binary task image resides)
- Data section (where initialized program data resides)
- BSS section (where uninitialized program data resides)
- Heap (where dynamic memory with malloc() and free() is allocated)
- Stack records user process; grows downward
+--------------------+
| "text" (bin. exe) |
+--------------------+
| data |
+--------------------+
| BSS |
+--------------------+
| . |
| . |
| . |
+--------------------+
| stack |
+--------------------+
Kinds of C language variables
- Automatic variables are pushed onto the stack when a function is called.
- Initialized variables are stored in the "data" segment.
- Uninitialized variables are stored in the BSS segment.
int max_pix_val = 255; /* goes in "data" segment */
int pix_val; /* goes in BSS segment */
main(argc,argv)
{
int width=640; /* goes in "automatic" */
int height=480; /* goes in "automatic" */
int m, n; /* go in "automatic" */
static myNaN = 255; /* goes in BSS */
}
Here's an example I found with www search on
keywords: bss, test, stack, (Clemson University Fall 2001)
Assigned readings from the course textbook (man pages)
- ldd - list dynamic dependencies of executable files or shared objects
- ld - the GNU linker
- lint - C program verifier
- ar - create, modify, and extract from archives.
- ranlib - generate index to archive.
- nm - list symbols from object files
- objdump - display information from object files
- size - list section sizes and total size.