Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!mcsun!ukc!strath-cs!cs.glasgow.ac.uk!bru-cc!eesrajm From: eesrajm@cc.brunel.ac.uk (Andrew J Michael) Newsgroups: comp.os.minix Subject: Re: Unified MINIX GNU port Summary: ld rather than gcc Message-ID: <1985@Terra.cc.brunel.ac.uk> Date: 1 Feb 91 23:32:52 GMT References: <43079@nigel.ee.udel.edu> <739@philica.ica.philips.nl> Organization: Brunel University, Uxbridge, UK Lines: 62 In article <739@philica.ica.philips.nl>, adrie@philica.ica.philips.nl (Adrie Koolen) writes: > In article <1991Jan29.234455.10126@jarvis.csri.toronto.edu> wayne@csri.toronto.edu (Wayne Hayes) writes: > >In article <43079@nigel.ee.udel.edu> HBO043%DJUKFA11.BITNET@cunyvm.cuny.edu (Christoph van Wuellen) writes: > >>My question, would it be tolerable to use the originial GNU a.out format and > >>design a conversion program that converts GNU binaries to MINIX binaries (stuff deleted) > There's a handier way to do this. For Minix-Sparc, the GNU C compiler also > generates an a.out file with a GNU header (which is in fact a SunOS compatible > executable file header). I adopted the compiler dispatcher, gcc.c, to call > a conversion program, cv in my case, to change the header and the symbol > table to the Minix format. You only have to fiddle with link_spec to call > your conversion program at the end. If your interested, I can mail the cdiff > file against gcc.c of 1.37.1, it's some 40 lines. I guess, that other persons, > who ported GNU C to Minix-386 did the same thing, as this the way to do it. > > Adrie Koolen (adrie@ica.philips.nl) > Philips Innovation Centre Aachen I thought about doing it this way and decided to alter gcc-ld instead, for two main reasons. Firstly, on a conceptual basis, the job of the linker is to take object files and turn them into a running executable. There are several Makefiles in MINIX and elsewhere which assume that calling the linker on its own will produce a workable output. I suggest that it is entirely reasonable to expect this to work. Altering gcc.c won't have that effect. Secondly, patching gcc.c is not easy. It's pretty awkward to keep track of the existing link-spec code without making it even more difficult. On the other hand, gcc-ld consists of lines like do_something(); do_something_else(); which make it extremely easy to add a three line patch #ifdef MINIX do_convert(); #endif The conversion routines themselves live in separate files which are totally independent of gcc-ld, thereby "future-proofing" them against changes in gcc-ld itself. I must admit that I still have a leaning towards Alan Black's idea of getting MINIX to understand GNU format a.out directly. His solution of the chmem problem is pretty neat as well. However I do wonder what happens if MINIX includes - does it then get covered by the copyleft ??? Andy Michael -- Andy Michael (eesrajm@cc.brunel.ac.uk) "You might think that. I 85 Hawthorne Crescent couldn't possibly comment." West Drayton Middlesex UB7 9PA