rfg@nsc.nsc.com (Ron Guilmette) (10/15/88)
In a recent posting, dave@questar.MN.ORG (David Becker) wrote: >I am attempting to get g++-1.25 going on an AT&T 3b1 which uses the >COFF a.out format. A document accompanying the g++ distribution >specifically states COFF is not supported. > >ld++ and collect use a.out.h and need to be COFFized. >Has anyone rectified this situation and taught g++ COFF? > >gcc-c++ works fine and is producing objects, only a way to link >remains to be found. Has anyone gotten any version of g++ going on a 3b1? > >On a more theorectical level, why is a specialized loader necessary? >How is a standard ld insufficient for the job? I have a set of patches to g++ 1.27.0 which allow it to use a standard AT&T style COFF linker. I have already forwarded them to M. Tiemann and I hope that they will be incorporated into the next release of G++. Anyone who wants a copy should just send me E-mail to that effect and I will send out the compressed, uuencoded context-diffs for my patches. Regarding the "theoretical" question, the special magic which ld++ (or in past times "collect.c") provide is simply to initialize a list of addresses of so-called "file level" constructors and destructors. These lists are traversed (at run-time) by crt0 and exit() (respectively) so that all "class objects" which are declared at a global level (i.e. outside of all functions) get properly "constructed" (before main() is called) and then also "destructed" (before _exit() is finally called). The scheme I use with my COFF linker is to let it construct these lists by making (clever?) use of so-called "user-defined" (extra) segments.