I rerun the compiler with -v option. This is the output: ./xgcc -B/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/ -B/ usr/local/rdos/bin/ -B/usr/local/rdos/lib/ -isystem /usr/local/rdos/include -isystem /usr/local/rdos/sys-include -o conftest conftest.c -v Reading specs from /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/specs Target: rdos Configured with: ./configure --prefix=/usr/local --target=rdos --enable-languages=c++ --with- new-lib --disable-nls Thread model: single gcc version 4.2.0 20060107 (experimental) /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/cc1 -quiet -v -iprefix /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/../lib/gcc/rd os/4.2.0/ -isystem /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/include -isys tem /usr/local/rdos/include -isystem /usr/local/rdos/sys-include conftest.c -quiet -dumpbase conftest.c -auxbase conftest -version -o /tmp/ccqYdYTq.s ignoring nonexistent directory "/usr/local/rdos/sys-include" ignoring nonexistent directory "/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/../lib/gcc/r dos/4.2.0/include" ignoring nonexistent directory "/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/../lib/gcc/r dos/4.2.0/../../../../rdos/sys-include" ignoring nonexistent directory "/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/../lib/gcc/r dos/4.2.0/../../../../rdos/include" ignoring nonexistent directory "/usr/local/lib/gcc/rdos/4.2.0/include" ignoring nonexistent directory "/usr/local/lib/gcc/rdos/../../../rdos/sys-include" ignoring duplicate directory "/usr/local/lib/gcc/rdos/../../../rdos/include" #include "..." search starts here: #include <...> search starts here: /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/include /usr/local/rdos/include End of search list. GNU C version 4.2.0 20060107 (experimental) (rdos) compiled by GNU C version 3.3.5 (Debian 1:3.3.5-13). GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096 Compiler executable checksum: f98e310a4280cba4baed3f3c7ae436b0 /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/as -o /tmp/ccETnZpT.o /tmp/ccqYdYTq.s /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/collect2 -m - o conftest crti.o /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/crtbegin.o start_dyn.o init_term_dyn.o -L/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu /gcc -L/usr/local/rdos/bin -L/usr/local/rdos/lib -L/usr/local/lib/gcc/rdos/. ./../../rdos/lib /tmp/ccETnZpT.o -lgcc -lc -lgcc /usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc/crtend.o crtn.o /usr/local/bin/rdos-ld: unrecognised emulation mode: -o Supported emulations: elf_i386 collect2: ld returned 1 exit status
It seems like GCC is providing collect2 with an empty parameter for emulation mode, which then is interpreted using the next parameter (-o) instead. When I logged the same compile without the first /B option, GCC passes -m elf_i386 to collect2, and everything works. I rebuilt GCC using gcc-4.1-20051008 with the same patches I used with gcc-4.2-20060107, but it doesn't have this problem. Where in the code should I look for this? How is emulation mode determined? Why does this only fail in the newly built cross directory, and nowhere else? Leif Ekblad > In configure script, line 2580, there is a link test which checks if > an executable can be generated. The config.log file emits the > following errors: > > /usr/local/bin/rdos-ld: unrecognised emulation mode: -o > Supported emulations: elf_i386 > collect2: ld returned status 1 exit status. > > This error later in the configure scripts leads to an abort > with "Link tests are not allowed after GCC_NO_EXECUTABLES". > > To try to figure out this problem, I manully compiled the same > file with the same options using the same compiler (xgcc), and > it returns the same error. I then tried to use the cross-compiler > built using gcc-4.1-20051008, with which I can build other > executables, and it returns the same error. Only if I remove > the "-B/usr/src/toolchain/gcc-4.2-20060107/host-i686-pc-linux-gnu/gcc" > option, does it generate the executable without any errors. How > can this include give ld the wrong emulation mode? Apparently, > there is no "-o" in any file in the build-directory. > > Is this a known problem? > > Leif Ekblad