[cfe-dev] direct machine code generation for arm target

reed kotler rkotler at mips.com
Tue Sep 6 19:33:05 PDT 2011


Does anybody know the right incantation for having clang generate arm 
machine code without the
need for gas or some other external assembler? I'm not concerned with 
the particular variant.

buntu-rkotler:~/test> ~/build_llvm_assembler/install/bin/clang hello.c 
-ccc-host-triple arm-unknown-linux -ccc-clang-archs arm -c
clang: warning: unknown platform, assuming -mfloat-abi=soft
hello.c:4:3: warning: implicitly declaring C library function 'printf' 
with type
       'int (const char *, ...)'
   printf("hello\n");
   ^
hello.c:4:3: note: please include the header <stdio.h> or explicitly 
provide a
       declaration for 'printf'
1 warning generated.
/tmp/hello-81a3aS.s: Assembler messages:
/tmp/hello-81a3aS.s:1: Error: unknown pseudo-op: `.syntax'
/tmp/hello-81a3aS.s:2: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-81a3aS.s:3: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-81a3aS.s:4: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-81a3aS.s:5: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-81a3aS.s:6: Error: unknown pseudo-op: `.eabi_attribute'
/tmp/hello-81a3aS.s:13: Error: invalid character '{' before operand 1
/tmp/hello-81a3aS.s:14: Error: too many memory references for `mov'
/tmp/hello-81a3aS.s:15: Error: too many memory references for `sub'
/tmp/hello-81a3aS.s:16: Error: expecting operand after ','; got nothing
/tmp/hello-81a3aS.s:17: Error: invalid char '[' beginning operand 2 `[sp'
/tmp/hello-81a3aS.s:18: Error: no such instruction: `ldr r0,.LCPI0_0'
/tmp/hello-81a3aS.s:19: Error: no such instruction: `bl printf'
/tmp/hello-81a3aS.s:20: Error: no such instruction: `ldr r1,[sp,'
/tmp/hello-81a3aS.s:21: Error: invalid char '[' beginning operand 2 `[sp]'
/tmp/hello-81a3aS.s:22: Error: too many memory references for `mov'
/tmp/hello-81a3aS.s:23: Error: too many memory references for `mov'
/tmp/hello-81a3aS.s:24: Error: invalid character '{' before operand 1
/tmp/hello-81a3aS.s:25: Error: no such instruction: `bx lr'
clang: error: assembler command failed with exit code 1 (use -v to see 
invocation)

thanks.

reed




More information about the cfe-dev mailing list