Re: Compiler bootstrapping and the standard header files

Christian Gollwitzer <auriocus@gmx.de>
Fri, 20 Mar 2020 10:21:11 +0100

          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: Christian Gollwitzer <auriocus@gmx.de>
Newsgroups: comp.compilers
Date: Fri, 20 Mar 2020 10:21:11 +0100
Organization: A noiseless patient Spider
References: 20-03-018
Injection-Info: gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="85200"; mail-complaints-to="abuse@iecc.com"
Keywords: practice
Posted-Date: 20 Mar 2020 11:43:08 EDT
In-Reply-To: 20-03-018

Hi codevisio,


Am 19.03.20 um 13:40 schrieb codevisio@gmail.com:
> I've been going through come compiler sources available online and study
> them, in particular C compilers.
>
> 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.


No, such a rule does not exist and it would not make sense, either. The
easiest way to see this is by considering a cross-compiler.


Assume that your new compiler runs on host A (e.g. x86 PC) and compiles
a program for host B (e.g. ARM Raspberry Pi). Then for running the
compiler on the PC, you need the headers for the Raspi on the PC. But
the resulting binary does not run there.


The compiler itself must have been compiled by a compiler on the PC -
because if you compile it with itself, it would not run on th PC.
Therefore, to compile the compiler, you need the host compiler of the PC
and the headers and libraries from there.


Actually, a "cross compiler" is the regular case, and a "non-cross
compiler" is a special case, albeit many developers only use one machine
for compilation and testing, and therefore use a "non-cross compiler"
where the target is the same as the host.


Post a followup to this message

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