I have this problem during linking qemu under Ubuntu 5.10 (linux-ppc).
The system is up to date, and I'm using the gcc-3.4 as you can see.
gcc-3.4 -g -Wl,-T,/home/fausap/qemu/ppc.ld -o qemu-i386 elfload.o main.o syscall.o mmap.o signal.o path.o osdep.o thunk.o vm86.o libqemu.a gdbstub.o -lm
/usr/bin/ld: qemu-i386: Not enough room for program headers (allocated 8, need 9)
/usr/bin/ld: final link failed: Bad value
collect2: ld returned 1 exit status
make[1]: *** [qemu-i386] Error 1
make[1]: Leaving directory `/home/fausap/qemu/i386-user'
make: *** [all] Error 1
The problem is in ppd.ld with SIZEOF_HEADERS variable. I fixed it copying the standard linker script elfppc32.x from /usr/lib/ldscripts in the qemu directory renaming it as ppc.ld
Now the link is ok.
After, I have a problem with an ASM instruction:
make[1]: Entering directory `/home/fausap/qemu/arm-user'
gcc-3.4 -Wall -O2 -g -fno-strict-aliasing -D__powerpc__ -I. -I/home/fausap/qemu/target-arm -I/home/fausap/qemu -I/home/fausap/qemu/linux-user -I/home/fausap/qemu/linux-user/arm -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -I/home/fausap/qemu/fpu -I/home/fausap/qemu/slirp -c -o elfload.o /home/fausap/qemu/linux-user/elfload.c
/home/fausap/qemu/linux-user/elfload.c: In function `load_elf_binary':
/home/fausap/qemu/cpu-all.h:253: error: inconsistent operand constraints in an `asm'
/home/fausap/qemu/cpu-all.h:253: error: inconsistent operand constraints in an `asm'
make[1]: *** [elfload.o] Error 1
Now, finding in other sources the occurence of stwbrx asm operand, I saw there's no need of "=m" operand in the __asm__ call.
Also, in the qemu code, the function is declared return void in the cpu-all.h file.
So i changed the line in :