Thread View: gnu.g++
4 messages
4 total messages
Started by Piercarlo Grandi
Mon, 23 Oct 1989 16:29
Re: Please describe how to use g++/gdb with COFF
Author: Piercarlo Grandi
Date: Mon, 23 Oct 1989 16:29
Date: Mon, 23 Oct 1989 16:29
106 lines
5178 bytes
5178 bytes
In article <20941.625010978@ics.uci.edu> rfg@ICS.UCI.EDU writes:
The "GNU Linker" Approach
-------------------------
A very different means of getting g++ up on COFF systems
has been implemented primarily by Dirk Grunwald
(grunwald@cs.colorado.edu). I appologize if there were
other people (in particular, MDT) who also worked on this,
and who I have failed to give proper credit to. In any
case, the "GNU Linker" approach is prefered by Michael
Tiemann and by the FSF because it uses fewer non-free
software tools. This approach relies on a program call ed
MDT writes:
Another reason I prefer this approach is because linking need
only be performed once. Using other approaches require the
link to be performed at least twice: once to figure out what
is needed, and once to then link in code which performs the
initialization.
rfg comments:
Which "other approaches" are you refering to? The "AT&T Linker"
approach I described only does *one* link step. Are there yet more
approaches that I should have mentioned also?
Ron Guilmette described TWO approaches; actually there are FOUR, of which THREE
are used with COFF:
AOUT with the GNU ld++
The GNU ld++ will scan the .o files as it links them and will
generate the proper magic to activate the constructor and
destructor lists.
COFF with the GNU ld++
You must use gas and robotussin to generate COFF encapsulation
.o files, that is files that have a COFF header but an AOUT
body; gas will do the trick from .s files, robotussin from
existing .o and .a files; once this has done you can still use
GNU ld++, that will essentially ignore the COFF header and only
deal with the AOUT body, reducing the problem to the previous one.
COFF with collect
You generate .o files using the native System V assembler in
COFF format; you link them with their C++ libraries, and scan
them collect that will generate the appropriate
contructor/destructor lists, then you link these with the
result of the previous link and with the C libraries.
COFF with .ini .fini
The System V linker can generate two sections of object, .ini
and .fini, that contain initialization/termination code for the
executable. You can modify G++ so that it puts static
constructor/destructor calls in these sections, and then the
standard System V assembler, linker and crt?.o will take care
of everything.
These are orthogonal to the problem of symbol table style (there are
three, DBX, GDB, SDB), which is what mainly holds back GDB (as
apparently GDB can scan happily both COFF and AOUT objects)..
But I suppose if you are afflicted with COFF (or its related
diseases), the time spent linking is among the least of your
overall computer problems.
I cannot (and do not) disagree that COFF is a "disease". I do
prefer a less drastic "cure" however. :-)
There are two executable file formats: traditional AOUT and COFF. For
some reason RMS has decided that GNU will use AOUT. COFF is actually
vastly more flexible. There are also several alternative symbol table
formats, as well. Time to link is a damn nuisance. COFF is a *good
thing*.
P.S. Can you comment on the shared library problem? Is there
really a problem there, or was that just a rumor?
The problem is that shared libraries under System V do have their own
constructors and destructors; that is why COFF has .ini/.fini
sections. If you use the stock crt?.c file as in the G++ distribution,
it will not activate these sections, and shared libraries will not
work. It is actually fairly easy to add to the crt?.c file the required
magic.
In the patches to G++ for SystemV/386 I posted some weeks ago there are
ways to use the 'COFF with collect' way of doing things (I would have
preferred doing the .ini/.fini trick, but that meant altering the
compiler, as compared to altering the collect program, and I would not
want to do that before the full 2.0 mods were done by MDT), and updates
to crt?.c and System V ld scripts to support both shared libraries and
its -z option (unmapping of the first 20K of virtual mem to catch stray
null pointer dereferencing).
Apparently they have found in part their way into 1.36 (which I don't
have yet, so I don't know for sure).
--
Piercarlo "Peter" Grandi | ARPA: pcg%cs.aber.ac.uk@nsfnet-relay.ac.uk
Dept of CS, UCW Aberystwyth | UUCP: ...!mcvax!ukc!aber-cs!pcg
Penglais, Aberystwyth SY23 3BZ, UK | INET: pcg@cs.aber.ac.uk
Re: Please describe how to use g++/gdb with COFF
Author: Robert Claeson
Date: Wed, 25 Oct 1989 09:09
Date: Wed, 25 Oct 1989 09:09
16 lines
1148 bytes
1148 bytes
In article <1444@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes:
>There are two executable file formats: traditional AOUT and COFF. For
>some reason RMS has decided that GNU will use AOUT. COFF is actually
>vastly more flexible. There are also several alternative symbol table
>formats, as well. Time to link is a damn nuisance. COFF is a *good
>thing*.
Actually, there are even more of them -- SCO Xenix uses something that
they call x.out, and System V, Release 4.0 is supposed to use yet another
object file format (called Extended Object Format or something similar).
And I suspect there are some that I don't know about.
--
Robert Claeson E-mail: rclaeson@erbe.se
ERBE DATA AB
Re: Please describe how to use g++/gdb with COFF
Author: Ron Guilmette
Date: Sat, 28 Oct 1989 02:43
Date: Sat, 28 Oct 1989 02:43
49 lines
2757 bytes
2757 bytes
In article <1444@aber-cs.UUCP> pcg@cs.aber.ac.uk (Piercarlo Grandi) writes: > >Ron Guilmette described TWO approaches; actually there are FOUR, of which THREE >are used with COFF: I was speaking only of the number of approaches to get G++ up *only* on COFF based systems. So the correct number is three. In any case, I stand corrected. >COFF with the GNU ld++ >COFF with collect >COFF with .init/.fini sections (this is the AT&T linker approach) > P.S. Can you comment on the shared library problem? Is there > really a problem there, or was that just a rumor? > >The problem is that shared libraries under System V do have their own >constructors and destructors; that is why COFF has .ini/.fini >sections. If you use the stock crt?.c file as in the G++ distribution, >it will not activate these sections, and shared libraries will not >work. It is actually fairly easy to add to the crt?.c file the required >magic. Right. I have already done so to my version of crt0.c for G++. >In the patches to G++ for SystemV/386 I posted some weeks ago there are >ways to use the 'COFF with collect' way of doing things (I would have >preferred doing the .ini/.fini trick, but that meant altering the >compiler, as compared to altering the collect program, and I would not >want to do that before the full 2.0 mods were done by MDT)... The compiler changes are very minor and probably do not affect the parts of the compiler that MDT is now working on. >...and updates >to crt?.c and System V ld scripts to support both shared libraries and >its -z option (unmapping of the first 20K of virtual mem to catch stray >null pointer dereferencing). Changing crt0/1.c and adding a linker directives file are both trivial (especially when the changes are already tested and available). Most linker directives files are only about 8 lines long. Arguing that the AT&T linker approach involves too many changes is just plain silly. C'mon people! We are only talking about a hundred lines or less of patches! This is getting ridiculous. I guess that *anything* can be characterized as being "too complicated" or "too risky" so long as you don't really *want* to consider anybody's solution other than your own.
Re: Please describe how to use g++/gdb with COFF
Author: Ron Guilmette
Date: Mon, 13 Nov 1989 02:39
Date: Mon, 13 Nov 1989 02:39
29 lines
1933 bytes
1933 bytes
In article <4115@dell.dell.com> james@raid.dell.com (James Van Artsdalen) writes: >In <PCG.89Oct31193848@emerald.cs.aber.ac.uk>, pcg@emerald.cs.aber.ac.uk (Piercarlo Grandi) wrote: > >> All we need now is to persuade MDT that the .init/.fini sections >> handling, and the rest of the System V.3.2 paraphernalia, should >> be put into the mainline G++ setup, > >I do not think .init sections are necessarily a good idea. Any code >placed in a .init section should probably not call malloc(3c), since >malloc(3c) will not have been initialized yet (in the shared library >case). collect may be a hack, but the issue of when constructors and >destructors are run seems much more controllable than with .init. James, You are correct. When I used extra sections to bring up g++, I created two new sections called .ctors and .dtors. Note however that the problem that you have described is a *general* problem with the C++ language, i.e. the order in which global objects get initialized (i.e. constructed) is not defined. Thus, your *own* constructors (when used for global objects) cannot reliably call library routines (of any kind, but especially if the routines to be called are themselves hunks of C++ code that rely on prior "initialization" of their own globals for proper operation). P.S. Please send me my diskettes! // rfg
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads