[ros-kernel] Variable initialization bug in GCC 3.3.1

Mike Nordell tamlin at algonet.se
Wed Jun 2 18:30:16 CEST 2004


Eric Kohl wrote:

> > I just found a bug in GCC 3.3.1.
>
> Ouch! It's not a bug, it's a feature!
>
> GCC 3.3 and above locate zero-initialized variable in the .bss segment.

That is IMO a bug. Any (static/global) data explicitly initialized is
expected to be put in the data segment.

> We have to disable this feature for FreeLoader because allocated
> memory is not zero-initialized by default.

The problem is with freeloader. You might want to have a look at the msvc6
module to see how I solved the freeloader problem when teaching the ROS
kernel to be compiled by VC (the code sucks, but it does the job and
hopefully displays clearly what is required).
http://cvs.reactos.com/cgi-bin/cvsweb.cgi/msvc6/ntoskrnl/ke_i386_multiboot.c
?rev=1.1.1.1

There are IMO a number of arguments speaking in favor of creating an
intermediate loader that is loaded by freeloaders "dumb" multiboot spec
("read file into memory and then jump to hard-coded pointed-to address",
which is impossible to do using C, instead of doing a PE loading), all which
falls back to "freeloader isn't a PE loader".

/Mike



More information about the Ros-kernel mailing list