llvm-gcc cross compiler for ARM Linux failing

I suspect that my llvm-gcc cross compiler is using the wrong
assembler because it does not recognize "-mcpu=cortex-a8".

I was trying to build a cross compiler for a Mac host. Now I am trying
to build on x86_64 Linux. I am targeting a Beagle board with an ARM
Cortex-A8 and Angstrom Linux.

TRIED: to use the script in llvm/utils/crosstool/ARM/build-install-linux.sh
I used the recommended version of CodeSourcery and the same SVN revision.

RESULT: llvm-gcc builds but when I try to use it I get "as:
unrecognized option `-meabi=4'"

TRIED: using the latest CodeSourcery 2009q1 and latest LLVM REV 74564

RESULT: llvm-gcc failed to build with this error:

   /tmp/ccVSwC0h.s:535: Error: selected processor does not support
`strd r2,[r6]'
   make[3]: *** [libgcc/./_udivmoddi4.o] Error 1

TRIED: adding --with-cpu=cortex-a8 to configuration for llvm-gcc

RESULT: llvm-gcc now builds but when I try to use it I get "as:
unrecognized option `-mcpu=cortex-a8'"

I suspect it is using the wrong assembler. But when I do llvm-gcc -v I
can see it has:

  --with-gnu-as=/home/neel/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-as

If I use that assembler directly I get an executable but printf,
fflush and others are UNDefined.

I can compile programs using the CodeSourcery gcc toolchain just fine.
I did not even have to install the runtime code on the Beagle Board.
it just worked.

Any suggestions?

Has anyone recently built an LLVM cross compiler for ARM Linux?

Thanks,
Neel

I suspect that my llvm-gcc cross compiler is using the wrong
assembler because it does not recognize "-mcpu=cortex-a8".

This is a known problem. We've only added support for ARMv7 (including cortex-a8) in llvm in the last week or so, and the associated changes for llvm-gcc are still pending. Unless you need specific features of your cortex-a8 processor, you should be able to make progress getting things to work by specifying an older ARMv6 processor.

Hi, Bob

This is a known problem. We've only added support for ARMv7
(including cortex-a8) in llvm in the last week or so, and the
associated changes for llvm-gcc are still pending.

The processor support part itself was committed ~month ago. I built
llvm-gcc for cortex-a8 / a9 and arch armv7-a without any problems. I
have no idea, however, whether codesourcery tools in question support
these targets - I built binutils by myself.

Hi, Neel

I suspect it is using the wrong assembler. But when I do llvm-gcc -v I
can see it has:

--with-gnu-as=/home/neel/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-as

But how's assembler actually called? Just try to compile something
with extra -v option added

Hello Anton,

Thanks for replying.

The message "as: unrecognized option `-mcpu=cortex-a8'"
is the same message I get when I just enter:

  as -mcpu=cortex-a8

So I think I llvm-gcc is using the Linux i386 assembler to assemble
ARM code. Not good. What assembler is it supposed to use? The one in
CodeSourcery?

But how's assembler actually called? Just try to compile something
with extra -v option added

Did: llvm-gcc -v simple.c

Oh right, I had forgotten about that. It sounds like this is more of an ARM/Linux issue then. I'm afraid I can't help much with that.

Hello, Neel

So I think I llvm-gcc is using the Linux i386 assembler to assemble
ARM code. Not good.

Yes, seems so

What assembler is it supposed to use? The one in CodeSourcery?

Right

Configured with: /home/neel/xllvm/build-xl/src/llvm-gcc-4.2/configure
--enable-languages=c,c++
--enable-llvm=/home/neel/xllvm/install-xl/llvm-project/x86_64-unknown-linux-gnu/arm-none-linux-gnueabi/llvm
--prefix=/home/neel/xllvm/install-xl/llvm-project/x86_64-unknown-linux-gnu/arm-none-linux-gnueabi/llvm-gcc-4.2
--program-prefix=llvm- --target=arm-none-linux-gnueabi
--with-cpu=cortex-a8
--with-gnu-as=/home/neel/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-as
--with-gnu-ld=/home/neel/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-ld
--with-sysroot=/home/neel/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc

It seems that --with-gnu-as / --with-gnu-ld is somehow broken... Or
something like that. What if you add
/home/neel/CodeSourcery/Sourcery_G++_Lite/bin to your PATH before
configuring (so you can run arm-none-linux-gnueabi-as by hands) and
configure llvm-gcc without --with-gnu-as/ld options?