Problem cross-compiling llvm-gcc for AIX-PowerPC

Compiling llvm-gcc on an x86 machine with --target=powerpc-ibm-aix5.1.0.0, I get the following error:

make \
           CFLAGS="-g -O2 -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings -Wold-style-definition -Wmissing-format-attribute " \
           CONFIG_H="config.h auto-host.h ../../llvm-gcc-4.2-2.7.source/gcc/../include/ansidecl.h" \
           MAKEOVERRIDES= \
           -f libgcc.mk all
make[3]: Entering directory `/localhome/simmon12/aix-cross/obj/gcc'
/localhome/simmon12/aix-cross/obj/./gcc/xgcc -B/localhome/simmon12/aix-cross/obj/./gcc/ -B/localhome/simmon12/aix-cross/obj/../install/powerpc-ibm-aix5.1.0.0/bin/ -B/localhome/simmon12/aix-cross/obj/../install/powerpc-ibm-aix5.1.0.0/lib/ -isystem /localhome/simmon12/aix-cross/obj/../install/powerpc-ibm-aix5.1.0.0/include -isystem /localhome/simmon12/aix-cross/obj/../install/powerpc-ibm-aix5.1.0.0/sys-include -O2 -O2 -g -O2 -DIN_GCC -DCROSS_DIRECTORY_STRUCTURE -W -Wall -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes -Wold-style-definition -isystem ./include -mlong-double-128 -g -DHAVE_GTHR_DEFAULT -DIN_LIBGCC2 -D__GCC_FLOAT_NOT_NEEDED -Dinhibit_libc -I. -I. -I../../llvm-gcc-4.2-2.7.source/gcc -I../../llvm-gcc-4.2-2.7.source/gcc/. -I../../llvm-gcc-4.2-2.7.source/gcc/../include -I../../llvm-gcc-4.2-2.7.source/gcc/../libcpp/include -I../../llvm-gcc-4.2-2.7.source/gcc/../libdecnumber -I../libdecnumber -I/localhome/simmon12/llvm-makefilebuild/include -DL_muldi3 -c ../../llvm-gcc-4.2-2.7.source/gcc/libgcc2.c -o libgcc/./_muldi3.o
/localhome/simmon12/aix-cross/obj/./gcc/as: line 2: exec: -u: invalid option

Is there anything else I should be doing to build a cross-compiler to generate LLVM bitcode for AIX? My ultimate goal here is just to get a compiler which can generate llvm bitcode I can manipulate and then run through the C backend to generate source I can then compile on AIX. Unfortunately, I must run the code on AIX on POWER. How should I best approach this problem?

--Patrick

Hello

../../llvm-gcc-4.2-2.7.source/gcc/libgcc2.c -o libgcc/./_muldi3.o
/localhome/simmon12/aix-cross/obj/./gcc/as: line 2: exec: -u: invalid option

Have you built & installed cross-binutils for your target?

No, I hadn't. There's no special LLVM version of binutils, right? You just download binutils and compile it for a different target? I've looked up some stuff and I think I need a cross-glibc as well. Is it necessary to install AIX headers somewhere, too? Also, is there anything LLVM-specific necessary for cross-compiling llvm-gcc?

I'm sorry if this is off-topic. If there's nothing LLVM-specific about cross-compiling llvm-gcc, I'll direct future questions to a GCC list.

--Patrick

Hello, Patrick

I'm sorry if this is off-topic. If there's nothing LLVM-specific about
cross-compiling llvm-gcc, I'll direct future questions to a GCC list.

wrt cross-compilation llvm-gcc is pretty much same as gcc. So, you
need to have cross-tools available.
The only difference is the magic --enable-llvm switch :slight_smile: