Path: csiph.com!xmission!news.snarked.org!border2.nntp.dca1.giganews.com!border1.nntp.dca1.giganews.com!nntp.giganews.com!news.iecc.com!.POSTED.news.iecc.com!nerds-end From: Hans-Peter Diettrich Newsgroups: comp.compilers Subject: Re: Compiler bootstrapping and the standard header files Date: Fri, 20 Mar 2020 01:34:59 +0100 Organization: Compilers Central Lines: 32 Sender: news@iecc.com Approved: comp.compilers@iecc.com Message-ID: <20-03-019@comp.compilers> References: <20-03-018@comp.compilers> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit 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 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-018@comp.compilers> Xref: csiph.com comp.compilers:2490 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