Re: Compiler bootstrapping and the standard header files

Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Fri, 20 Mar 2020 01:34:59 +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)
[1 later articles]
| List of all articles for this month |

From: Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups: comp.compilers
Date: Fri, 20 Mar 2020 01:34:59 +0100
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="33637"; mail-complaints-to="abuse@iecc.com"
Keywords: practice
Posted-Date: 19 Mar 2020 21:48:37 EDT
In-Reply-To: 20-03-018

Am 19.03.2020 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.


For every program you need the standard libraries and headers for the
*target* system, for which you compile and link your program. The
headers are required at compile time, the libraries at link time. Both
come with the development system that you use to build your program.


Now you have everything to build your own compiler, for whatever
language, headers and library files you have it designed. Your compiler
has incorporated the libraries of the original development system,
what's okay for the compiler itself, but you are not normally allowed to
ship those original libaries with your new compiler, for building new
programs. So you have to create and build also your own headers and
libraries, using the original development system because your new
compiler is still useless without its own libraries.


Having done that you can use your compiler to build programs. First some
simple tests, like Hello World, but finally you may want your compiler
to compile itself as a proof of fitness. In former times gcc was built
recursively, i.e. every new compiler compiled its own source code again,
until two versions produced the same binaries. Dunno how the procedure
looks nowadays.


DoDi


Post a followup to this message

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