> I have several questions and hope somebody could help me with the answers:
> 1. how to use gcc to compile the user mode program with larger stack size?
You don't. The Linux kernel will autyomagically grow the stack as needed.
> 2. Inside the user mode program, I have declared some gloabal data
> which is being put on the bss section and I would like to know whom
> initialize the bss section? How big is the bss section? Under what
> kind of situation, the bss section data could be corrupted?
The kernel resp. the C runtime environment will initialize the BSS
for you. The BSS will be initialized with zero values.
The BSS section is as big as needed to put all objects of matching
type into it (this is determined at link time).
The BSS may get corrupted in exactly the same situations when any
other memroy corruption can happen, i. e. typically writing through a
rogue pointer, writing beyound the valid index range of an array,
errors using malloc() and free(0, etc.
> 3. What's the difference to compile the program with -G 0 option?
> That menas I don't use the $gp register, will there be any side
Quoting the GCC info pages:
Put global and static objects less than or equal to NUM bytes into
the small data or bss sections instead of the normal data or bss
sections. The default value of NUM is 8. The `-msdata' option
must be set to one of `sdata' or `use' for this option to have any
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-4596-87 Fax: (+49)-8142-4596-88 Email: email@example.com
"I dislike companies that have a we-are-the-high-priests-of-hardware-
so-you'll-like-what-we-give-you attitude. I like commodity markets in
which iron-and-silicon hawkers know that they exist to provide fast
toys for software types like me to play with..." - Eric S. Raymond