[LLVMdev] configuring cross compiler for Mac to Linux on ARM

Neel Nagar neelnagar42 at gmail.com
Mon Jun 29 13:30:11 PDT 2009


Hello,

I am trying to cross compile LLVM.
Build and compile on Mac OS X 10.5.7
Target is an Angstrom Linux Cortex-A8 Beagle board.
I would like to avoid GPLv3.

I can compile. But when I run my executable on Beagle crt0.S is
calling an AngelSWI to
setup the heap and stack.  But the AngelSWI seems to just be a stub
because it returns zeros for the pointers. That leads to a segfault.

If I hack in a reasonable stack then I can run some simple code. But
it dies if I try to printf() or do anything system related.

I am building binutils, then llvm, then combined.   I have tried many
different combinations of configure options. I have RTFM and RTFS but
am still stumped.  Any help would be greatly appreciated.

Currently using:  ../../combined/configure
--prefix=/Users/neel/llvm/llvm-top/install/onmacosx/arm
--build=i686-apple-darwin9 --host=i686-apple-darwin9 --target=arm-eabi
--with-cpu=cortex-a8 --with-fpu=neon --with-abi=aapcs
--with-float=hard
--enable-llvm=/Users/neel/llvm/llvm-top/build-la/llvm
--program-prefix=llvm- --enable-languages=c,c++ --disable-bootstrap
--with-newlib --with-headers=yes --disable-multilib

Questions:

1) What are the best configure options for building this cross
compiler Mac => ARM Linux?

2) Is newlib recommended for use with Linux and LLVM? I have read posts
saying newlib is obsolete and other posts saying it is critical. Some
posts suggest it is only needed for running on bare metal with no OS?

3) Are the AngelSWIs supported on ARM Linux? They don't seem to do
anything for me when I call them. They may be just stubs.

4) Should I use ARM_RDI_MONITOR or ARM_RDP_MONITOR or nothing on Beagle?

5) I have read lots of conflicting advice on what my target should be.
Should I use "arm-elf" or "arm-eabi" or "arm-angstrom-linux-gnueabi"
or "arm-none-linux-gnueabi" or...?

Here is what I get when I compile a very simple C program using:

    llvm-gcc -v -specs=linux.specs simple.c

Using built-in specs.
Reading specs from
/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/lib/linux.specs
rename spec lib to libc
Target: arm-eabi
Configured with: ../../combined/configure
--prefix=/Users/neel/llvm/llvm-top/install/onmacosx/arm
--build=i686-apple-darwin9 --host=i686-apple-darwin9 --target=arm-eabi
--with-cpu=cortex-a8 --with-fpu=neon --with-abi=aapcs
--with-float=hard
--enable-llvm=/Users/neel/llvm/llvm-top/build-la/llvm
--program-prefix=llvm- --enable-languages=c,c++ --disable-bootstrap
--with-newlib --with-headers=yes --disable-multilib
Thread model: single
gcc version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build)
 /Users/neel/llvm/llvm-top/install/onmacosx/arm/libexec/gcc/arm-eabi/4.2.1/cc1
-quiet -v -D__USES_INITFINI__ simple.c -quiet -dumpbase simple.c
-mcpu=cortex-a8 -mfloat-abi=hard -mfpu=neon -mabi=aapcs -auxbase
simple -version -o
/var/folders/0L/0L9UbM9ZEWShfNO8Ptl4sE+++TI/-Tmp-//ccwys5tO.s
ignoring nonexistent directory
"/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/sys-include"
#include "..." search starts here:
#include <...> search starts here:
 /Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/include
 /Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/include
End of search list.
GNU C version 4.2.1 (Based on Apple Inc. build 5646) (LLVM build) (arm-eabi)
	compiled by GNU C version 4.0.1 (Apple Inc. build 5490).
GGC heuristics: --param ggc-min-expand=150 --param ggc-min-heapsize=131072
Compiler executable checksum: 91bde4799b0a9c4384e1675516753c28
 /Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/bin/as
-mcpu=cortex-a8 -mfloat-abi=hard -mfpu=neon -meabi=4 -o
/var/folders/0L/0L9UbM9ZEWShfNO8Ptl4sE+++TI/-Tmp-//ccqpsSXn.o
/var/folders/0L/0L9UbM9ZEWShfNO8Ptl4sE+++TI/-Tmp-//ccwys5tO.s
 /Users/neel/llvm/llvm-top/install/onmacosx/arm/libexec/gcc/arm-eabi/4.2.1/collect2
-X /Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/lib/linux-crt0.o
/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/crti.o
/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/crtbegin.o
-L/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1
-L/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/../../../../arm-eabi/lib
/var/folders/0L/0L9UbM9ZEWShfNO8Ptl4sE+++TI/-Tmp-//ccqpsSXn.o
--start-group -lgcc -lc -lgloss-linux --end-group
/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/crtend.o
/Users/neel/llvm/llvm-top/install/onmacosx/arm/lib/gcc/arm-eabi/4.2.1/crtn.o


Thanks,
Neel



More information about the llvm-dev mailing list