clang -target arm hello.c ,
clang -target armv7 hello.c ,
clang -target armv7-a hello.c,
clang -target arm-eabi hello.c
$ clang -target arm-none-eabi hello.c
/tmp/hello-c8aebe.s: Assembler messages:
/tmp/hello-c8aebe.s:1: Error: unknown pseudo-op: `.syntax'
/tmp/hello-c8aebe.s:2: Error: unknown pseudo-op: `.cpu'
/tmp/hello-c8aebe.s:3: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:4: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:5: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:6: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:7: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:8: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:9: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-c8aebe.s:16: Error: invalid char '{' beginning operand 1 `{r11'
/tmp/hello-c8aebe.s:17: Error: too many memory references for `mov'
/tmp/hello-c8aebe.s:18: Error: too many memory references for `sub'
/tmp/hello-c8aebe.s:19: Error: expecting operand after ','; got nothing
/tmp/hello-c8aebe.s:20: Error: invalid char '[' beginning operand 2 `[r11'
/tmp/hello-c8aebe.s:21: Error: no such instruction: `ldr r1,.LCPI0_0'
/tmp/hello-c8aebe.s:22: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/hello-c8aebe.s:23: Error: too many memory references for `mov'
/tmp/hello-c8aebe.s:24: Error: no such instruction: `bl printf'
/tmp/hello-c8aebe.s:25: Error: no such instruction: `ldr r1,[sp,'
/tmp/hello-c8aebe.s:26: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/hello-c8aebe.s:27: Error: too many memory references for `mov'
/tmp/hello-c8aebe.s:28: Error: too many memory references for `mov'
/tmp/hello-c8aebe.s:29: Error: invalid char '{' beginning operand 1 `{r11'
/tmp/hello-c8aebe.s:30: Error: no such instruction: `bx lr'
clang: error: assembler (via gcc) command failed with exit code 1 (use -v to see invocation)> I can`t get any type information on llvm document.
Hi,
That's because there is no right answer, as it depends on the
environment. But there is a document that teaches how to cross-compile
that has some hints:
http://clang.llvm.org/docs/CrossCompilation.html
The section on Target Triple tells you that you must follow whatever
your distribution calls the tool you want to use. For example, if you
have "arm-none-eabi-as", then you need the triple to be
"arm-none-eabi" and set CPU/FPU manually via -mcpu/-mfpu.
IIRC, Ubuntu also has "armv7-linux-gnueabihf" or something, and that
would chose Cortex-A8 + NEON by default, with hard-float, so you'll
need less cpu/fpu options.
In a nutshell, use whatever triple you have your target toolchain in the path.
Another option is to use the --sysroot option, if you have unzipped
your toolchain somewhere like /opt. This will also help you defining
the libraries and headers location, and avoid a lot of -I and -L
options.
> $ clang -target arm-none-eabi hello.c
> /tmp/hello-c8aebe.s: Assembler messages:
> /tmp/hello-c8aebe.s:1: Error: unknown pseudo-op: `.syntax'
I hate this error, and I think Clang could do *a lot* better, but this
is because Clang didn't find the target assembler and defaults to the
host's version, which of course, is x86, not ARM.
I think Clang should *at least* warn that it didn't find the target's
assembler and is defaulting to something, especially when host !=
target.
cheers,
--renato
_______________________________________________
LLVM Developers mailing list
llvm...@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev