Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.compilers > #2500
| From | Kaz Kylheku <493-878-3164@kylheku.com> |
|---|---|
| Newsgroups | comp.compilers |
| Subject | Re: Compiler bootstrapping and the standard header files |
| Date | 2020-03-23 13:49 +0000 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <20-03-029@comp.compilers> (permalink) |
| References | <20-03-018@comp.compilers> <20-03-019@comp.compilers> <20-03-021@comp.compilers> <20-03-023@comp.compilers> <20-03-028@comp.compilers> |
On 2020-03-22, Christopher F Clark <christopher.f.clark@compiler-resources.com> wrote: > cvo asked: > > Your assumptions up to this one seemed correct to me. > > 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? > > If you header and libraries are written in standard C, and the > original compiler works properly when you use them with it. Your replacement C library, if it is to be actually stand-alone (not depending on system libraries) can't be written entirely in standard C. For example, I/O requires system calls, which use bits of assembly code, inline or otherwise. If that library has to be boostrapped with the host compiler, it may have to rely on /its/ extensions (like inline assembler). If those kinds of extensions look different in your own compiler, and you want to be able to rebuild the library with it, /that/ code will have to be written twice just due to the compiler differences, never mind all the times it has to be written for different machines. You're making a lot of extra work for yourself, including future portability chores, if you make your own library. > But listen carefully, to John, our moderators, comments and consider > not writing your own library when writing your own compiler. I can > probably count on one hand with fingers left over the number of times > he's been wrong in the years I've been reading here. More importantly. > Don't make unnecessary work for yourself. Writing a compiler is > plenty to do. Adding more work on that pile, just means you won't do > as good a job on it as you would if you had it as your only task. A C library is not only a language library; it's platform abstraction layer. Platform vendors provide these. If you want a compiler that can be ported to many platforms, you can't be replicating the work of all those vendors; it is not tractable. A compiler may have to have a special run-time library to implement certain things that have to do with the language itself, like any math operators that can't be implemented in-line. A compiler could ship with some interesting library that the compiler vendor promotes. Like say that your compiler provides some interesting features like dynamic compilation. Of course, you have to provide your own API to it which accompanies the compiler. Just don't go re-implementing POSIX and ISO C, I think.
Back to comp.compilers | Previous | Next — Previous in thread | Next in thread | Find similar
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