Initialization of .BSS question.

Conor P. Cahill cpcahil at virtech.uucp
Fri Jun 29 11:43:19 AEST 1990


In article <1319 at proto.COM> joe at proto.COM (Joe Huffman) writes:
>I am porting the runtime library from a MSDOS compiler to UNIX.  Under
>SCO UNIX (first target) the .BSS segment is initialized to all 0's by
>the OS (at least prior to the application code getting control).  Under
>MSDOS this was the responsiblity of the startup code.  I currently have
>it removed from the UNIX version but was a bit concerned that under some
>versions of UNIX it may be necessary to include it.  As other discussions

ANY C compiler, when building an executable for a hosted environment, on any
machine under any OS that doesn't initialize all of non-initialized global
variables (.BSS) to all 0's is VERY BROKEN.

You will not have to add any initialization code to set this stuff to 
zero.  (And should not have to add it to your DOS compiler.  (However, 
you DOS compiler may have this stuff in it's setup code that is called
prior to your main() routine, but you should not have to be aware of this
mechanism)).


-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.,
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 



More information about the Comp.unix.wizards mailing list