9

I am trying to learn how to port GCC to new architectures. Most tutorials say that I only have to create three files named my_processor.c my_processor.h and my_processor.md; however when running ./configure --target=my_processor machine is not recognized.

Following an answer given in How to write your own code generator backend for gcc?, I added my configuration in config.sub and ./configure worked.

Unfortunately, when I use make, the terminal returns an error saying

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 

The problem seems to be due to a bad configuration in gcc/config.gcc, maybe because I added my architecture in a wrong place (there are multiple case ${target}, so not sure which choose) or because I am missing something.

The only information that I have found appears in https://gcc.gnu.org/onlinedocs/gcc-4.2.2/gccint/Back-End.html, but it is not complete enough.

So, how could I do to avoid this error?

2
  • Yes, you need to edit more configuration files. You could check when recent backends were added to see what files they edited. Commented Jan 3, 2018 at 20:33
  • 2
    gcc.gnu.org/ml/gcc-cvs/2017-02 see r245224 ... r245231 for the introduction of the RISCV port. Commented Jan 3, 2018 at 20:40

1 Answer 1

4

Krister Walfridsson's blog has a detailed description of all the steps needed to create a new backend. The first in the series is about the 8 kinds of files to be changed or created. It's also suggested to follow the logic for a Moxie backend that might be easier to start with than risc-v.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.