*BSD News Article 1606


Return to BSD News archive

Xref: sserve gnu.gcc.help:2354 comp.unix.bsd:1639
Newsgroups: gnu.gcc.help,comp.unix.bsd
Path: sserve!manuel!munnari.oz.au!comp.vuw.ac.nz!mark
From: mark@comp.vuw.ac.nz (Mark Davies)
Subject: gcc under BSD NET2 (Was Re: gcc2.2.2 for 386BSD,success?)
Nntp-Posting-Host: bats.comp.vuw.ac.nz
Message-ID: <Bq2qEB.3E5@comp.vuw.ac.nz>
Organization: Dept. of Comp. Sci., Victoria Uni. of Wellington, New Zealand.
Sender: news@comp.vuw.ac.nz (News Admin)
Date: Fri, 19 Jun 1992 03:44:33 GMT
References:  <1992Jun18.102431.23045@ntuix.ntu.ac.sg>


In article <1992Jun18.102431.23045@ntuix.ntu.ac.sg>, eoahmad@ntuix.ntu.ac.sg (Othman Ahmad) writes:
|> I have successfully compiled gcc-2.2.2 into stage1 and dhryston.c v1.1
|> with the following performances. I am now compiling into stage2.

   [...]

|> The main problems tha I had was:

|> gvarargs and gstdarg.h do not  work. Must use host compiler.
|> omehow va_list is not defined anywhere in gvarargs. Note that the installation
|> program actually copies gvarargs and gstdargs to libdir/varargs.h and stdargs.h.In making stage1, must replace them with original compiler(gcc1.39) headers.

|> gstddef.h does not include size_t typedef which is just
|> unsigned int. Comment out size_t in gstdef.h. Use those that come
|> with stdio.h.

The stdarg.h and varargs.h implementations with gcc do not interwork with the
implementations in NET2 -- partly due to a typo but mostly because they just
dont fit together.

The typo mentioned above is that _ANSI_H in gvarargs.h should be _ANSI_H_ and
the gstdarg.h should have a similar wrapping (testing for _ANSI_H_).  If this
was done then these header files would work if your source happens to include
<machine/ansi.h> *before* it includes whichever of <stdarg.h> or <varargs.h>
but *not* in the reverse order.

What I do to get gcc2.* running on my BSD NET2ish system (not a 386) follows:

Edit gstdarg.h and gvarargs.h to take out the "lets try and work out the
appropiate defines for arbitrary system X" ifdef's and just leave the correct
value for this system, which for gvarargs.h is:

#define va_list __va___list
typedef char * __va___list;

and for gstdarg.h is:

typedef char *va_list;

I can't think of a clean way of automatically determining you are on a NET2
system that you could tie in to the general stuff here.

Other changes I needed:

gstddef.h also causes problems in bootstrapping because of differences between
how it and the system header files go about insuring ptrdiff_t, size_t and
wchar_t are typedefed only once and to the "correct" value.

This patch to libgcc2.c is needed to bootstrap:

*** libgcc2.c~  Tue Jun 16 10:03:00 1992
--- libgcc2.c   Tue Jun 16 11:46:03 1992
***************
*** 30,36 ****
  
  #include "tm.h"
  #ifndef L_trampoline
! #include "gstddef.h"
  #endif
  
  /* Don't use `fancy_abort' here even if config.h says to use it.  */
--- 30,36 ----
  
  #include "tm.h"
  #ifndef L_trampoline
! #include "stddef.h"
  #endif
  
  /* Don't use `fancy_abort' here even if config.h says to use it.  */

Once installed, I rm stddef.h and limits.h from "gcc-lib/.../include" so that
everything just uses the systems ones.

My system "cc" is actually gcc 1.40 with -traditional so for the first stage
of bootstrapping I need to make the following patches to the generated insn-*
files:

*** insn-extract.c~     Tue Jun 16 11:32:04 1992
--- insn-extract.c      Fri Jun 19 15:33:37 1992
***************
*** 11,17 ****
  extern char recog_dup_num[];
  extern
  #ifdef __GNUC__
! volatile
  #endif
  void fatal_insn_not_found ();
  
--- 11,17 ----
  extern char recog_dup_num[];
  extern
  #ifdef __GNUC__
! __volatile
  #endif
  void fatal_insn_not_found ();

*** insn-output.c~      Tue Jun 16 11:33:54 1992
--- insn-output.c       Fri Jun 19 15:34:07 1992
***************
*** 14,22 ****
  
  #include "insn-codes.h"
  
- #include "recog.h"
- 
  #include <stdio.h>
  #include "output.h"
  
  static char *
--- 14,21 ----
  
  #include "insn-codes.h"
  
  #include <stdio.h>
+ #include "recog.h"
  #include "output.h"
  
  static char *

And thats all there is to it :-)

cheers
mark