Cross-compiling for cortex-m3: how do I get ride of -ccc-gcc-name ?

Hi there,

I'm using clang to cross compile for cortex-m3. I eventually managed to
do so with

clang++ -ccc-gcc-name arm-none-linux-gnueabi-g++ -ccc-host-triple
thumbv7m-none-gnueabi source.cpp -c -mcpu=cortex-m3

I would like to understand what -ccc-gcc-name does exactly and how
can I get ride of it?

From what I understand, it's needed by the driver in order to find the binutils

for calling the assembler and the linker. Is that correct?

After some grep'ing I ended up in gcc::Common::ConstructJob, where the option
value is retrieved, but I'm not sure how does it fit with the rest.

How else can I tell llvm where to look for binutils?

Hope someone can save me a few hours around the codebase
with some insights.

Regards,
Salvatore

Making a symlink to clang in the same directory as the GCC / binutils (I'll call it $ARM_BIN) called

arm-none-linux-gnueabi-clang (and one with clang++ too)

and another link in the $ARM_BIN/../lib directory to clang directory located under clang's lib (for includes)
should be enough.

Gordon Keiser
Software Development Engineer
Arxan Technologies
gkeiser@arxan.com www.arxan.com

I'm sorry, I should have been more clear. I don't just want to get
right of the option itself, I want not to
have the need to a have a GCC cross-toolchain around.

I did download and cross compile binutils myself. I'd like llvm to use
that by default.

Is that possible?

Thanks,
Salvatore

That requires a bit more than just compiling binutils. You'll need a
working linker and a perfect interaction between run-time libraries
and compiler generated code (read exception handling, RTTI, etc),
which LLVM hasn't.

The compiler-rt project is aiming to fix the latter, but not too close
to achieving it yet, I'm afraid. I'm not sure there is a project (or
the desire) to implement a full linker for multiple platforms.

I'm not sure what you mean by a working linker, as that comes with
the binutils.

As for the run-time libraries, I know that you mean, I just
forgot to also add that for my current project I don't need any of them. :slight_smile:
I don't plan to link either libc or libcxx. So I expect that to be achievable.

Thanks,
S.

I'm not sure what you mean by a working linker, as that comes with
the binutils.

Main line GCC may have gotten close to seamless producing ARM code,
but last time I checked, using CodeSourcery was far simpler than
trying to compile GCC for ARM.

Even if you do manage to do that (many people have), it might not be
easy enough to recommend it to the general public, at least not as
easy as "install code-sourcery, use -ccc-gcc-name/symlink to
arm-none-eabi-clang", for the time being.

As for the run-time libraries, I know that you mean, I just
forgot to also add that for my current project I don't need any of them. :slight_smile:
I don't plan to link either libc or libcxx. So I expect that to be achievable.

In that case, it might just work. Report back if it does. :wink: