Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.compilers > #2490

Re: Compiler bootstrapping and the standard header files

From Hans-Peter Diettrich <DrDiettrich1@netscape.net>
Newsgroups comp.compilers
Subject Re: Compiler bootstrapping and the standard header files
Date 2020-03-20 01:34 +0100
Organization Compilers Central
Message-ID <20-03-019@comp.compilers> (permalink)
References <20-03-018@comp.compilers>

Show all headers | View raw


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

Back to comp.compilers | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Compiler bootstrapping and the standard header files codevisio@gmail.com - 2020-03-19 05:40 -0700
  Re: Compiler bootstrapping and the standard header files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-03-20 01:34 +0100
    Re: Compiler bootstrapping and the standard header files Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-20 06:21 -0400
      Re: Compiler bootstrapping and the standard header files cvo <codevisio@gmail.com> - 2020-03-20 15:52 -0700
        Re: Compiler bootstrapping and the standard header files Hans-Peter Diettrich <DrDiettrich1@netscape.net> - 2020-03-22 04:22 +0100
        Re: Compiler bootstrapping and the standard header files Christopher F Clark <christopher.f.clark@compiler-resources.com> - 2020-03-22 13:51 -0400
          Re: Compiler bootstrapping and the standard header files Kaz Kylheku <493-878-3164@kylheku.com> - 2020-03-23 13:49 +0000
  Re: Compiler bootstrapping and the standard header files Christian Gollwitzer <auriocus@gmx.de> - 2020-03-20 10:21 +0100
  Re: Compiler bootstrapping and the standard header files gah4@u.washington.edu - 2020-03-21 15:32 -0700

csiph-web