GCC - 如何为新架构添加支持?

Zer*_*int 10 gcc porting cross-compiling

我正在尝试学习如何将GCC移植到新架构.大多数教程说,我只需要创建一个名为三个文件my_processor.c my_processor.hmy_processor.md; 但是当运行./configure --target=my_processor机器无法识别时.

如何为gcc编写自己的代码生成器后端中给出答案,我添加了我的配置config.sub./configure工作.

不幸的是,当我使用时make,终端返回错误说

checking if mkdir takes one argument... no
*** Configuration my_processor-unknown-none not supported
Makefile:4230: recipe for target 'configure-gcc' failed
make[1]: *** [configure-gcc] Error 1
make[1]: Leaving directory 'objdir'
Makefile:905: recipe for target 'all' failed
make: *** [all] Error 2
Run Code Online (Sandbox Code Playgroud)

问题似乎是由于配置错误gcc/config.gcc,可能是因为我在错误的地方添加了我的架构(有多个案例$ {target},所以不确定选择哪个)或因为我遗漏了一些东西.

我发现的唯一信息显示在https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gccint/Back-End.html中,但它不够完整.

那么,我该怎么做才能避免这个错误呢?

min*_*hua 3

Krister Walfridsson 的博客详细描述了创建新后端所需的所有步骤。该系列的第一篇是关于要更改或创建的 8 种文件。还建议遵循 Moxie 后端的逻辑,这可能比 risc-v 更容易上手。