3

I want to build GCC from source as a cross compiler for ARM bare-metal targets. Specifically, I need support for the architectures armv4t and armv5te with softfp for both of them since they lack a proper FPU.

The (relevant) flags I used are

--with-cpu=arm946e-s --with-mode=arm --with-float=soft --enable-interwork --enable-multilib --with-multilib-list=armv4t,armv5te 

This way I tried to achieve that the compiler will default to armv5te with the --with-cpu option and still maintain the opportunity to build for armv4t.

Binutils build worked fine, however when building gcc's subdir gcc the multilib check failed with:

For arm946e-s real value is arm946e-s Error: --with-multilib-list=armv4t,armv5te not supported. make: *** [Makefile:4356: configure-gcc] Error 1 

I looked up on how to enable armv5te support since armv4t with the arm7tdmi seems to be a default multilib target but found no results. There doesn't even seem to be a proper list of valid multilib targets. Removing the multilib list yielded a build of armv4t and armv7-a multilibs which I don't need to support.

How can I build both targets successfully with softfp?

2
  • gcc.gnu.org/install/configure.html --with-multilib-list= only takes rmprofile or/and aprofile, nothing else Commented Jul 23, 2020 at 14:20
  • armv5te is not a cortex series architecture so neither profile will solve the problem Commented Jul 23, 2020 at 14:48

1 Answer 1

3
+50

TL-DR; There is no need. Use a wrapper and link to the desired standard libraries.

For soft and hard float, both the gcc libraries and generated code are effected. For a system with armv4 and armv5, the same compiler will always be able to generate the same code. Moreover, the generated objects are the same ABI. Ie, they pass parameters using the same mechanism. So the assembler instruction with-in an object may target armv4 or armv5. If you are on the armv5 architecture you may even link and run the armv4 objects. There is no issue except the code is sub-optimal.

You may build gcc libraries twice with the armv4 and armv5 options. Save the generated libraries. Headers will be identical. When you build armv5, use the armv5 libraries. Use -mcpu, -isystem (if you like) and -L to get the armv5 optimized libraries. For this reason I would use the armv4 build as the default. For certain this can be done with -freestanding and a gcc-armv5 wrapper script.


The multilib configuration is special in that the actual compiler binary can generate two sets of prologue and epilogue. Even before multilib it was always possible to generate either armv4 or armv5 code using the same compiler with -mcpu, or -march and -mtune. It is just they had the same prologue and epilogue. The instruction generation backend in gcc has always been multicpu. Probably multilib would better be named multiabi.

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.