arm code generation

Hello,

I’m trying to do the following and encountering problems with the generated arm assembly code:

I’ve got an application in two parts that i’ve compiled into llvm bitcode using:
llvm-gcc -emit-llvm -c part1.c -o part1.bc
llvm-gcc -emit-llvm -c part2.c -o part2.bc

Then I link them together:
llvm-ld part1.bc part2.bc -o combined.bc

Now I use the ARM backend via llc to generate the assembly for my target processor from combined.bc:
llc -march=arm -mcpu=arm7tdmi combined.bc

The problem is when I run the generated file (combined.s) through an arm cross compiler for my target (arm-elf gcc toolchain) I get the following errors below. Has anybody encountered this before? Is there a way to do this?

combined.s: Assembler messages:

combined.s:216: rd and rm should be different in mul
… repeated a few times
combined.s:969: rd and rm should be different in mla
… repeated a few times

combined.s:1330: Error: unknown pseudo-op: `.cstring’

combined.s:1335: Error: junk at end of line, first unrecognized character is `,’
… repeated many times

combined.s:1366: Error: character following name is not ‘#’
combined.s:1370: Error: unknown pseudo-op: .indirect_symbol' combined.s:1375: Error: unknown pseudo-op: .lazy_symbol_pointer’
combined.s:1377: Error: unknown pseudo-op: `.indirect_symbol’
… repeated a few times

combined.s:1393: Error: unknown pseudo-op: `.subsections_via_symbols’

Thank you,

-aa

For this to work, you need to build llvm-gcc as a cross compiler to the appropriate arm target.

-Chris

Hello,

I’m trying to do the following and encountering problems with the generated arm assembly code:

I’ve got an application in two parts that i’ve compiled into llvm bitcode using:
llvm-gcc -emit-llvm -c part1.c -o part1.bc
llvm-gcc -emit-llvm -c part2.c -o part2.bc

Then I link them together:
llvm-ld part1.bc part2.bc -o combined.bc

Now I use the ARM backend via llc to generate the assembly for my target processor from combined.bc:
llc -march=arm -mcpu=arm7tdmi combined.bc

The problem is when I run the generated file (combined.s) through an arm cross compiler for my target (arm-elf gcc toolchain) I get the following errors below. Has anybody encountered this before? Is there a way to do this?

combined.s: Assembler messages:

combined.s:216: rd and rm should be different in mul
… repeated a few times
combined.s:969: rd and rm should be different in mla
… repeated a few times

Your assembler is probably outdated. This restriction is not present in newish ARM incarnations.

Evan