I’m trying to build an application for ARC Classic, and I see that arc is in zig triples, but when I try to execute something like zig build-exe src/main.zig -target arc-freestanding -T src/linker.ld I get:
error: cannot emit arc binary with the LLVM backend; only '-femit-asm' is supported
If you look at the support table for the most recent release, you’ll see that code generation only supports assembly output. If you want to turn that into a binary, you’ll need to use an external ARC assembler that will process the Zig code output.
Note that with ARC being a tier 4 target, C/I tests aren’t run against this backend, so things likely may have more issues than simply lacking a machine code generator.
For context, Synopsys don’t even recommend using the ARC backend in LLVM; it’s very incomplete and unmaintained. Similar story for the CSKY backend. I’m honestly not sure why the LLVM project hasn’t removed those backends yet.
Good to know. I grabbed their GNU toolchain and can build C programs just fine - but unfortunately, I can’t figure out how to properly emit the ASM.
Executing zig build-lib -fno-emit-bin -target arc-freestanding -O ReleaseSmall -femit-asm=main.asm src/main.zig results in error: LLVM failed to parse 'arc-unknown-unknown-unknown': Unable to find target for this triple (no targets are registered).
Should I just not even use Zig at all and stick to their official toolchain? I’m just planning on writing some code for a dumb project on the EM9304, so it doesn’t have to be “rigorously” correct