Mail Archives: djgpp/1999/04/23/11:00:29
Christopher Nelson wrote:
> okay. thanks again. the one last question I had, and maybe this answered
> it, if you have an uninitialized global variable, it list's it's section as
> 0 in the COFF file. obviously 0 does not exist, since sections start at 1.
> am i supposed to allocate space for all the uninitialized variables myself?
> or are they stuck somewhere that's not obvious. my guess would have been
> bss, but that's not what happens...
It is a form of named common. You do need to allocate space for it.
The size of the required space was in some field that usually means
something else. IIRC it was in the field that gives the offset
within the segment.
I think you are supposed to be able to declare an uninitialized
global variable in more than one module. The linker matches them
up so that only one copy is actually allocated.
When I first added COFF support to my linker, this is the feature
I completely misunderstood. The HTML document on COFF format doesn't
seem to cover it at all. After I found the problem, I kludged in
code to merge all these into the end of the BSS. That is probably
not exactly what is intended, but it has worked well enough.
--
http://www.erols.com/johnfine/
http://www.geocities.com/SiliconValley/Peaks/8600/
- Raw text -