Re: Compiler bootstrapping and the standard header files

gah4@u.washington.edu
Sat, 21 Mar 2020 15:32:56 -0700 (PDT)

          From comp.compilers

Related articles
Compiler bootstrapping and the standard header files codevisio@gmail.com (2020-03-19)
Re: Compiler bootstrapping and the standard header files DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-03-20)
Re: Compiler bootstrapping and the standard header files auriocus@gmx.de (Christian Gollwitzer) (2020-03-20)
Re: Compiler bootstrapping and the standard header files christopher.f.clark@compiler-resources.com (Christopher F Clark) (2020-03-20)
Re: Compiler bootstrapping and the standard header files codevisio@gmail.com (cvo) (2020-03-20)
Re: Compiler bootstrapping and the standard header files gah4@u.washington.edu (2020-03-21)
Re: Compiler bootstrapping and the standard header files DrDiettrich1@netscape.net (Hans-Peter Diettrich) (2020-03-22)
Re: Compiler bootstrapping and the standard header files christopher.f.clark@compiler-resources.com (Christopher F Clark) (2020-03-22)
Re: Compiler bootstrapping and the standard header files 493-878-3164@kylheku.com (Kaz Kylheku) (2020-03-23)
| List of all articles for this month |

From: gah4@u.washington.edu
Newsgroups: comp.compilers
Date: Sat, 21 Mar 2020 15:32:56 -0700 (PDT)
Organization: Compilers Central
References: 20-03-018
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="29579"; mail-complaints-to="abuse@iecc.com"
Keywords: GCC, history
Posted-Date: 21 Mar 2020 20:44:14 EDT
In-Reply-To: 20-03-018

On Thursday, March 19, 2020 at 2:45:16 PM UTC-7, cvo wrote:


> I've been going through come compiler sources available online and study
> them, in particular C compilers.


One reason for the inability to use such is copyright.
But for now, I will assume that isn't the question.


> Since all of them implement the C standards headers, my assumption was that
> during the development of the compiler I cannot use the the standard headers
> coming from the host environment & C compiler, but instead I have to use my
> own standard headers I created for my compiler.


As well as I remember the early days of gcc, though I wasn't so interested
in it at the time, it was a replacement for an existing compiler,
such as the one for SunOS.


For some years, Sun had only one C compiler, distributed with SunOS,
but at some point they licensed it separately. The compiler that came
with SunOS was only meant to be enough to compile the kernel modules
needed for sysgen. (But I believe gcc started before this.)


In any case, at that time they used the existing SunOS (and maybe
others, but I was mostly using Sun at the time) library. Much of the
C header files have data structures (C struct) that match with
library routines.


I believe that gcc was trying to build a better optimizing
compiler, and to get people to use it over the SunOS compiler.
(Personal opinion, so anyone can disagree if they want to.)


It was only sometime later that GNU wrote their own glibc as a
replacement for the C library. Some data structures match system
calls, and so are system dependent, where others are only need
to be library internally consistent.


As for cross compilers, much of the data structures are consistent
across different architectures for the same system version, such
as 68020 SunOS and Sparc SunOS, such that the header files would
be the same, or almost the same. (As well as I remember, Sun
keeps the system dependent ones separate, with a symbolic link
to the actual version.)


Writing the compiler first, using the existing library,
conveniently allows one to get something working earlier.


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.