From: "Andrew Crabtree" To: Subject: RE: COFF format Date: Thu, 25 Feb 1999 16:28:48 -0800 Message-ID: <003401be611e$fa3eb7c0$6dd22b0f@ros51675cra.rose.hp.com> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook 8.5, Build 4.71.2377.0 In-reply-to: <199902260001.QAA14046@geocities.com> Importance: Normal X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3155.0 Reply-To: djgpp-workers AT delorie DOT com > 1) what's in eh_frame section ? (can I simply and silently ignore it ?) I believe the eh stuff is exception handling. Maybe frame unwind info? Can probably get a better feel for what goes in there if you peruse the gcc macros for x86 target. > 2) why non-static uninitialized global objects appear as "undefined" ? Well, it has to do with how the linker collapses things. I'm assuming you are talking about a .o file here, and not a finished executable. The problem is that your declaration char arr[1000]; is the same as extern char arr[1000]; as far as it knows. So when its looking at that one particular file it doesn't know if it needs to reserve bss space for an unitialized global or if the variable is declared somewhere else. The final linker figures things out. Some other fancier formats (ELF for instance) take better care of this. I think gld has an option of warn-common or something if you happen to make two globals the same name and one is explicit and one isn't. Does that make sense? Here's two examples to clear it up a little more. lets say you have one file, main.c. In it you have char arr[1000]; When you compile to a .o it fill make an unresolved external. When you make the .out or .exe the linker will know to reserve space for it. But, lets say you have this scenario. You have a main.c in which again you have char arr[1000]; but you have another file file2.c in which you have char arr[1000] = {0,1,2,3,4,5,...}; or something similar. The same thing happens to main.c when it is compiled to main.o, but this time the linker resolve arr to point into file2, which may or may not be what you wanted it to do. Its a throw back to old k&r days where nobody used the 'extern' keyword I would guess. > Is there some doc that explains that format ? No idea. HTH andy