x86 cross compiler for ppc fails to build

Hi All,

I try to build a cross-compiler that compiles for powerpc but runs on my pentium.

As a base I used the arm cross-compiler script but changed:
CROSS_HOST="x86_64-unknown-linux-gnu"
CROSS_TARGET="powerpc-linux"
CROSS_MARCH="750"

LLVM is building ok, but the second step: building llvm-gcc fails with a rather strange error which I appended to the end of this e-mail.
Am I doing something wrong or is this a bug?

Thanks,
  Maarten Faddegon

--- the error: ---

/llvm-gcc-4.2-2.9.source/gcc/../include -I/local/maartenf/opt/src/all_llvm_2_9/buildroot_ppc/src/llvm-gcc-4.2-2.9.source/gcc/../libcpp/include -I/local/maartenf/opt/src/all_llvm_2_9/buildroot_ppc/src/llvm-gcc-4.2-2.9.source/gcc/../libdecnumber -I../libdecnumber -I/local/maartenf/opt/bin/llvm29/powerpc-linux/llvm/include -g0 -finhibit-size-directive -fno-inline-functions -fno-exceptions -fno-zero-initialized-in-bss -fno-toplevel-reorder -Dinhibit_libc -msdata=none \
          -c /local/maartenf/opt/src/all_llvm_2_9/buildroot_ppc/src/llvm-gcc-4.2-2.9.source/gcc/crtstuff.c -DCRT_BEGIN \
          -o crtbegin.o
/tmp/ccNdqsm6.s: Assembler messages:
/tmp/ccNdqsm6.s:11: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:11: Error: junk at end of line: `(completed.2521.b)'
/tmp/ccNdqsm6.s:12: Error: junk at end of line: `(30)'
/tmp/ccNdqsm6.s:15: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:15: Error: junk at end of line: `(p.2519)'
/tmp/ccNdqsm6.s:16: Error: junk at end of line: `(29)'
/tmp/ccNdqsm6.s:22: Error: junk at end of line: `(29)'
/tmp/ccNdqsm6.s:25: Error: junk at end of line: `(29)'
/tmp/ccNdqsm6.s:30: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:30: Error: junk at end of line: `(__deregister_frame_info)'
/tmp/ccNdqsm6.s:31: Error: junk at end of line: `(3)'
/tmp/ccNdqsm6.s:34: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:34: Error: junk at end of line: `(__EH_FRAME_BEGIN__)'
/tmp/ccNdqsm6.s:35: Error: junk at end of line: `(3)'
/tmp/ccNdqsm6.s:39: Error: junk at end of line: `(30)'
/tmp/ccNdqsm6.s:76: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:76: Error: junk at end of line: `(__register_frame_info)'
/tmp/ccNdqsm6.s:77: Error: junk at end of line: `(3)'
/tmp/ccNdqsm6.s:80: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:80: Error: junk at end of line: `(__EH_FRAME_BEGIN__)'
/tmp/ccNdqsm6.s:81: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:81: Error: junk at end of line: `(object.2537)'
/tmp/ccNdqsm6.s:82: Error: junk at end of line: `(3)'
/tmp/ccNdqsm6.s:83: Error: junk at end of line: `(4)'
/tmp/ccNdqsm6.s:86: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:86: Error: junk at end of line: `(__JCR_LIST__)'
/tmp/ccNdqsm6.s:87: Error: junk at end of line: `(3)'
/tmp/ccNdqsm6.s:90: Error: syntax error; found `(' but expected `,'
/tmp/ccNdqsm6.s:90: Error: junk at end of line: `(_Jv_RegisterClasses)'
/tmp/ccNdqsm6.s:91: Error: junk at end of line: `(4)'
/tmp/ccNdqsm6.s:96: Error: junk at end of line: `(3)'
make[2]: *** [crtbegin.o] Error 1

Looks like you don’t have an assembler for your target installed that
llvm-gcc can find.

-eric

I try to build a cross powerpc compiler, but llvm-gcc fails.

Eric Christopher wrote:

Looks like you don't have an assembler for your target installed that llvm-gcc can find.

I have binutils installed for powerpc and verified they are working with a simple hello world program.

$ powerpc-750-linux-gnu-as --version
GNU assembler 2.16.1

However, the xgcc build during the seems to generate instructions that are not understood by the assembler.
I forced xgcc to output assembly and tried to use the assembler on the result manually.
There are instructions like this one "lis 30, ha16(completed.5554.b)" which are not understood apparently?
Should this instruction be understood by the assembler?

Thanks,
  Maarten

crtstuff.s (2.55 KB)

I try to build a cross powerpc compiler, but llvm-gcc fails on crtstuff.c / crtbegin.o

In the archives I found a thread where more or less the same problem is discussed:
http://lists.cs.uiuc.edu/pipermail/llvmdev/2011-January/037327.html

Can I conclude from this that indeed llvm-gcc for powerpc-linux is broken?
Is anyone maintaining llvm-gcc for powerpc-linux or is it abandoned?

Maarten Faddegon

Hello Maarten

Can I conclude from this that indeed llvm-gcc for powerpc-linux is broken?
Is anyone maintaining llvm-gcc for powerpc-linux or is it abandoned?

Noone is doing anything in ppc/linux land.

Hi, Maarten

Can I conclude from this that indeed llvm-gcc for powerpc-linux is broken?
Is anyone maintaining llvm-gcc for powerpc-linux or is it abandoned?

  IIRC, llvm-gcc can be built successfully on a Linux/PowerPC machine.
Here was my configuration,

$ ../llvm-gcc-4.2-2.8.source/configure --prefix=/path/to/install
--program-prefix=llvm- --enable-llvm=/path/to/install
--enable-languages=c,c++ --disable-bootstrap --disable-libmudflap
--disable-multilib --disable-libgomp
$ make install

  HTH. :slight_smile:

Regards,
chenwj

Can I conclude from this that indeed llvm-gcc for powerpc-linux is broken?
Is anyone maintaining llvm-gcc for powerpc-linux or is it abandoned?

You could also try using dragonegg. The good thing is that you would only
need to build vanilla gcc-4.5 as a cross-compiler. The bad thing is that
dragonegg has no support for ppc: you would need to port a bunch of logic
from llvm-gcc.

Ciao, Duncan.

If I recall correctly, this was a bug when generating 32bit ppc assembly
on linux. 64bit assembly might work better on linux.

kalle