将 GCC 移植到新架构 [英] Porting GCC to new architectures

查看:30
本文介绍了将 GCC 移植到新架构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何将 gcc 移植到新的架构?我对以下架构特别感兴趣:

How do I go about porting gcc to a new architecture? I am specifically interested in the following architectures:

  • ARM(TI OMAP)
  • TI MSP430
  • x86

但是关于如何移植到任何架构的指导会在某种程度上解决我的问题.

but guidance on how to port to any architecture would go some way to solving my problem.

推荐答案

学习移植 gcc 将是一项非常重要的任务.作为预期结果的粗略指南,您需要知道:

Learning to port gcc is going to be a significantly non-trivial task. As a rough guide of what to expect, you will need to know:

  • 由内而外的目标架构.从字面上看,否则你怎么知道如何将 C 转换为它?
  • C 标准,例如 C89、C99 等
  • 编译器的工作原理.有很多关于这方面的书.

为了开始这个过程,您通常会从主机架构上的 C 到汇编翻译开始,这样您就可以为目标架构(但在您的主机上)编译一些东西.然后,您将进入可以在主机上为目标架构编译编译器的阶段.在这个阶段,您在目标上生成一个编译器,然后可以自编译,因此您现在在目标上有 gcc.

In order to start the process, you would typically start with the C-to-assembly translation on your host architecture, such that you could compile something for the target architecture (but on your host). You would then get to the stage where you can compile a compiler for your target architecture on your host. At this stage, you produce a compiler on the target which can then self-compile, so you now have gcc on the target.

完成这项工作后,实际上移植 gcc 只是从目标主机上构建 gcc 的一个案例.如果您只对这些感兴趣,Linux from scratch 是一本非常好的指南做你需要做的一切(因为 gcc 将成为移植内核的先决条件).

Once this work has been done, actually porting gcc is simply a case of building gcc from the host on the target. If that's all you're interested in, Linux from scratch is a very good guide for doing everything you'll need to do (as gcc would, amongst other things, be a prerequisite for porting the kernel).

这篇关于将 GCC 移植到新架构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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