delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/09/04/14:12:55

From: Ivo Janssen <ivo AT ricardis DOT tudelft DOT nl>
Newsgroups: gnu.gcc.help,comp.os.msdos.djgpp
Subject: Re: Specs file format
Date: Mon, 1 Sep 1997 16:06:00 +0200
Organization: Delft University of Technology, Dept. of Electrical Engineering
Lines: 61
Message-ID: <Pine.LNX.3.95.970901144459.8311C-100000@ricardis.ricardis.tudelft.nl>
Reply-To: Ivo Janssen <ivo AT ricardis DOT tudelft DOT nl>
NNTP-Posting-Host: ricardis.ricardis.tudelft.nl
Mime-Version: 1.0
In-Reply-To: <340AB66B.4C25FF5E@Mathematik.TU-Chemnitz.DE>
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

On Mon, 1 Sep 1997, Robert Hoehne wrote:

> Now I looked also in gcc.c and found, that you can overwrite in
> the specs file, any builtin "default compiler spec" by adding
> some lines to the specs file. For instance:
> 
> .c: .....
> 
> Will execute what ever stands for the .....
> But please do not ask me now what the exact syntax is
> (probably the same like in gcc.c but the best would be
> to look in gcc.c and try to understand how 'read_specs()'
> work.

First of all, it seems that you don't need to include the whole
specs-file as dumped by gcc -dumpspecs. Only additional info has to be
specified. So I did:
------
.c:
@my_compiler

@my_compiler:
<do whatever specs I want>
------

Notice that you need to have exactly 1 blank line. Any other number
will result in a fatal error. Hmmmm.
So now, when I do "gcc foo.c -o foo", it processes the <do whatever>.

One thing left: In the built in specs (gcc.c: static struct
compiler default_compilers[]), an identifier (here: @my_compiler) can
have several specs. (struct compiler { char* suffix; char *spec[4]; }
). But read_specs can only read 1 spec from file and store it in
compiler.spec[0].
The default spec for ".c" files (@c) has spec[0], which does the
cpp-stage, and spec[1], which does the cc1 and as stage. In main(), it
seems that these two specs are just catted in one new char*, named p.
Then main() does do_spec (p). So I just put them after eachother in
the specs-file, thus putting both spec[0] (cpp) and spec[1] (cc1/as)
in one new spec[0]. And: everything WORKS!!!!!

So the bottom-line in my struggle is:
- No need to include all other specs, only new specs need to be in
  the file.
- Watch your newlines. Exactly 1 blank line between rules.
- You can cat specs, which internally are in seperate char*'s, into
  one.
- There definitily needs to be some documentation in the "Using and
  Porting GCC" info file!!!!!!! And it needs to be a lot clearer then
  the comments in "gcc.c". GNU people: do something!

Greetings, a very happy Ivo!

--------------------+--------------------------------+-+     +---+
| IVO JANSSEN       | ivo AT ricardis DOT tudelft DOT nl        | |     |   |
| Ricardishof 1/428 | janssen AT cardit DOT et DOT tudelft DOT nl   | |   |-+   |
| 2614 JE Delft     | http://www.et.tudelft.nl/~ivo/ | +->-|    (|)
| the Netherlands   | Dept of Electrical Engineering |     |-+   |
| +31-15-2855973    | Delft University of Technology |       |   |
+-------------------+--------------------------------+      --- ---

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019