This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Automaticly eliminating redundant zero initialisers



> [ we want to eleminate zero initializers and 
>  put them into the .bss section ... ]
>Soon as you depend on this some OS dude will fill bss with -1s so he can
>tell what was used... or some such.  Seems like a bad idea to depend on
>bss being anything at all.
>
>George

In fact, you can assume something if your system uses the "ELF" format
(which all unix flavours i know of do)

According to the ELF specs, Version 1.1,
the .bss section has a special interpretation:

" .bss  This section holds uninitialized data that contribute to the
        program's memory image. By definition, the system initializes the
        data with zeros when the program begins to run. The section occupies
        no file space, as indicated by the section type, SHT_NOBITS."

I don't know if newer specs exists, but it seems that any system that
uses ELF needs to guarantee this propertty.


regards,
Frank.

-- 
=======================================================================
         Frank Moehle                              | Understanding is a
Work   : Uni Oldenburg,Computer Architecture Group | three-edged sword.
Inhouse: frankm@haydn                              | (Vorlon saying)
DOMAIN : Frank.Moehle@Informatik.Uni-Oldenburg.DE  +-------------------
-----------------------------------------------------------------------
****            Its how you DO it, not how you don't.              ****

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]