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


Groups > comp.compilers > #2494

Re: Compiler bootstrapping and the standard header files

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.iecc.com!.POSTED.news.iecc.com!nerds-end
From cvo <codevisio@gmail.com>
Newsgroups comp.compilers
Subject Re: Compiler bootstrapping and the standard header files
Date Fri, 20 Mar 2020 15:52:02 -0700 (PDT)
Organization Compilers Central
Lines 72
Sender news@iecc.com
Approved comp.compilers@iecc.com
Message-ID <20-03-023@comp.compilers> (permalink)
References <20-03-018@comp.compilers> <20-03-019@comp.compilers> <20-03-021@comp.compilers>
Mime-Version 1.0
Content-Type text/plain; charset="UTF-8"
Injection-Info gal.iecc.com; posting-host="news.iecc.com:2001:470:1f07:1126:0:676f:7373:6970"; logging-data="64814"; mail-complaints-to="abuse@iecc.com"
Keywords practice
Posted-Date 21 Mar 2020 16:48:28 EDT
X-submission-address compilers@iecc.com
X-moderator-address compilers-request@iecc.com
X-FAQ-and-archives http://compilers.iecc.com
In-Reply-To <20-03-021@comp.compilers>
Xref csiph.com comp.compilers:2494

Show key headers only | View raw


Hi Hans-Peter, Christian and Christopher.

Thanks for all of your answer.

I reply here but my answer is for you all.


I'm not going to consider the cross-compiler case now.
My intention was to stick with the simplest scenario.

(
Premise: I'd use the term 'libraries' instead of 'runtime libraries'
since the majority, I think, of C standard function definitions are
implemented without OS API calls. At the same time there are two
libraries concepts, static and dynamic libraries. So in theory I
could link together the static libraries definitions inside my executable.
At least from the Windows world, but I guess the *nix also has those.
)


If I right understood you, the following are the steps.

1) Host compiler + host compiler headers + host compiler libraries
are used to compile my first version of my new compiler getting:
mygcc0 + mygcc0 C libraries.

2) Then I use mygcc0 + mygcc0 C headers + mygcc0 C libraries
to compile my second version of my new compiler getting: mygcc1 +
mygcc1 C libraries.

3) Eventually I use mygcc1 + mygcc1 C headers (== mygcc0 C headers) +
mygcc1 C libraries to compile my third version of my new compiler
getting: mygcc2 + mygcc2 C libraries.

Q1) Is that correct?
  If so, then point (1) above is a starting point. Point (2) is the
  first necessary step. While mygcc0 has code generated by the host
  compiler using its headers and its library functions, mygcc1 and
  mgcc1 C libraries instead have been generated by my new compiler,
  mygcc0.
  Q1.2) Is that correct?
    If so then also point (3) is a necessary step, because while it
    is true that mygcc1 has been generated by mygcc0 (without any
    host compilers), it is also true that I need a new version of my
    compiler to compare mygcc1 with. That is mygcc2.
    Q1.3) Is that correct?
      If so the the final and my first question is:
      Given a gcc in a linux environment with its C headers and
      with its C libraries, and given my compiler with its C headers
      and with its C libraries, as long as my C headers and C libraries
      conform semantically to the C standard, why cannot I use them
      in the first step, point (1), in place of host ones?

      Why do I ask that? Because I can start debugging and fixing my
      compiler along with my C libraries (and C headers) since the
      beginning instead of debugging my C libraries at step 2. In other
      words, it is true I can compile my C libraries at step 1, but I
      cannot debug their implementation yet because at step 1 I'm using
      the C libraries (and headers) from the host environment. I can
      debug my C libraries implementation only at step 2.


Thanks all.

[To your Q1.3, there is a lot of wiggle room in the C standard,
particularly in internal implementation details.  For example, in
stdio.h there is a definition of FILE as a typedef of an opaque
structure.  There is no reason that your C library's FILE structure
would be the same as gcc's.  I hope you're not planning to write your
own C library, since there are good quality open source ones you can
adapt. -John]

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