How to cross-compile for ARC in clang?

Hello everyone,

I’m trying to compile my test.cpp for ARC, using this guide

I’ve built my LLVM+CLANG with ARC, ARM and X86.

clang -target arc -S test.cpp
Gives me:
error: unknown target triple ‘arc’, please use -triple or -arch

clang -targer arm works fine

Is there any way to compile for ARC?

Could you run "llc --version"? It should print all targets that were built. Arc is an experimental target, did you use LLVM_EXPERIMENTAL_TARGETS_TO_BUILD?



[haze@haze-pc bin]$ ./llc --version
LLVM version 6.0.0
DEBUG build with assertions.
Default target: x86_64-unknown-linux-gnu
Host CPU: skylake

Registered Targets:
arc - ARC
x86 - 32-bit X86: Pentium-Pro and above
x86-64 - 64-bit X86: EM64T and AMD64


чт, 27 сент. 2018 г. в 14:46, Krzysztof Parzyszek via llvm-dev <>:

Oh, that’s what I was afraid of.
So there is definetly no way to compile for ARC?
If so, should I write ARC.h(.cpp) in lib/Basic/Targets in order to make it work?

чт, 27 сент. 2018 г. в 14:47, Tim Northover <>:

Yes, lib/Basic/Targets looks like the basic entry point. If you don't
care what ABI or CPU you get that might be enough. Otherwise you'll
want to investigate lib/CodeGen/TargetInfo.cpp and
lib/Driver/ToolChains/Arch/ARC.cpp too. There are other
target-specific details scattered around the source, but those are the
main ones to get started.



I suggest you reach out to the contributors of the LLVM ARC backend (CCd) to ask about their plans to contribute target support for Clang. I believe they have work in progress, but I don’t know their plans for contributing it. Tom.


Thanks for the note here.

We put up a patch a while back for enabling the ARC target in clang, the compiler:

(I didn’t realize this was from so far back until looking now).

The current backend has really only been exercised through C.

So, applying this patch should help.

We also have some driver changes which can be used to integrate with the ARC GNU toolchain. The sticky point is C++ support.