GCC / G ++是如何自举? [英] How are gcc/g++ bootstrapped?

查看:261
本文介绍了GCC / G ++是如何自举?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这已被窃听我一会儿。如何GCC / G ++编译自己?
我猜每个版本都得到了previously内置版本编译。这是真的?而如果是,它意味着最古老的G ++ / GCC版本是用汇编写的?

This has been bugging me for a while. How do gcc/g++ compile themselves? I'm guessing that every revision gets compiled with a previously built revision. Is this true? And if it is, does it mean that the oldest g++/gcc versions were written in assembly?

推荐答案

GCC的最早的版本是用另一种C编译器编译,因为它是写的时候还有其他人。最先C编译器永远(约1973年,IIRC)的实施无论是在 PDP-11装配或对B编程语言preceded它,但在任何情况下对B编译器汇编语言编写的。 同样,第一次C ++编译器(C pre / Cfront的,1979-1983)很可能是第一个用C实现的,然后再写入C ++。

The oldest version of GCC was compiled using another C compiler, since there were others when it was written. The very first C compiler ever (ca. 1973, IIRC) was implemented either in PDP-11 assembly, or in the B programming language which preceded it, but in any case the B compiler was written in assembly. Similarly, the first ever C++ compiler (CPre/Cfront, 1979-1983) were probably first implemented in C, then rewritten in C++.

在GCC编译或任何其他自托管的编译器,建筑的全顺序是:

When you compile GCC or any other self-hosting compiler, the full order of building is:


  1. 构建GCC的新版本与现有的C编译器

  2. 重新编译GCC的新版本与你刚刚建立一个

  3. (可选)重复步骤2进行验证。

这过程被称为引导。它测试编译本身的编译器的能力,并且确保所产生的编译器与所有内置的优化,它本身实现。

This process is called bootstrapping. It tests the compiler's capability of compiling itself and makes sure that the resulting compiler is built with all the optimizations that it itself implements.

修改:德鲁杜曼,在评论中,指向Bjarne的Stroustrup的帐户的最早实行C ++ 的。它是用C ++实现,但由什么斯特劳斯所说的preprocessor从C ++到C翻译;没有他的定义一个完整的编译器,但还是C ++是用C自举。

EDIT: Drew Dormann, in the comments, points to Bjarne Stroustrup's account of the earliest implementation of C++. It was implemented in C++ but translated by what Stroustrup calls a "preprocessor" from C++ to C; not a full compiler by his definition, but still C++ was bootstrapped in C.

这篇关于GCC / G ++是如何自举?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆