How to cross-compile for ARC in clang?

Hello everyone,

I’m trying to compile my test.cpp for ARC, using this guide https://clang.llvm.org/docs/CrossCompilation.html.

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?

-Krzysztof

Hi,

[haze@haze-pc bin]$ ./llc --version
LLVM (http://llvm.org/):
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

yes, I’ve set LLVM_EXPERIMENTAL_TARGETS_TO_BUILD=ARC

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

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 <t.p.northover@gmail.com>:

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.

Cheers.

Tim.

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.

Hello,

Thanks for the note here.

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

https://reviews.llvm.org/D43089

(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.

Pete