How to test GCC on a simulator

Suppose you want to test GCC on some strange target, for which you don't have hardware. Let's pick d30v as an example. You can do it like this:

Create a combined tree.

I'm assuming you're starting from scratch, so you don't have an installed binutils or newlib for the strange target. So you'll need to build these. You can't easily build newlib outside a combined tree. Start in an empty directory, then do this:

mkdir gcc src combined
cd gcc
cvs -d :pserver:anoncvs@gcc.gnu.org:/cvs/gcc co gcc-full
cd ../src
cvs -d :pserver:anoncvs@anoncvs.cygnus.com:/cvs/src co binutils newlib dejagnu gdb
cd src
find . -print | cpio -pdlm ../../combined
cd ../../gcc/gcc
find . -print | cpio -pdlmu ../../combined
cd ../..

This will create, in `combined', a tree which consists of all the files from the gcc and binutils/gdb/newlib source trees, with the gcc files overriding the binutils/gdb/newlib files when there's a conflict. (It's done this way because the gcc files are the master copy.) To save on disk space, the commands above actually make a tree of hard links, rather than duplicating all the files.

Build it.

The target name suitable for the simulator is usually `*-elf' for a target `*'. There are some exceptions, for instance on powerpc it's powerpc-eabi or powerpc-eabisim, and for i960 there isn't an elf target yet so i960-coff is probably your best choice.

mkdir build install
cd build
../combined/configure --target=d30v-elf --prefix=`pwd`/../install
make

Test it.

The only trick here is that you want dejagnu to use the simulator, not try running the output on the build system. For example:

make check-gcc RUNTESTFLAGS=--target_board=d30v-sim

The only reliable way (apart from guessing that it's probably `*-sim') to find out the name of the target board is to look in the dejagnu sources, in dejagnu/baseboards, for something that looks right. Or you can use this table of combinations that at one time /NEVER/ compiled and were /NOT/ usable as test-targets with the instructions above:

TargetSimulatorVerifiedComment
arm-elf arm-sim 20010723 ICE compiling cplus-dem.c
20010725 ICE compiling newlib/libm/math/sf_erf.c
20010727 -"-
d30v-elf d30v-sim 20010723 ICE compiling libgcc2.c:__do_global_dtors
20010725 -"-
20010727 -"-
fr30-elf fr30-sim 20010723 Needs --enable-languages=c++,java,objc to disable fortran, then gets out of memory compiling crtbegin.o
20010725 -"-
20010727 -"-
h8300-hms h8300-sim 20010723 ICE compiling libgcc2.c:_muldi3
20010725 -"-
20010727 ICE compiling newlib/libc/stdlib/assert.c
i960-elf i960-sim 20010723 No rule to make target `i960-c.o', needed by `cc1'
20010725 -"-
20010727 -"-
m32r-elf m32r-sim 20010723 Incorrect libgloss/m32r/configure.in (AC_PROG_CC). After copying construct from libgloss/rs6000, the assembler croaks when compiling libiberty/cplus-dem.c on garbage that looks like a string from GCC that wasn't GC-marked.
20010725 -"-
20010727 -"-
mcore-elf mcore-sim 20010723 ICE compiling libgcc2.c:_subvsi3
20010725 -"-
20010727 -"-
mips-elf mips-sim 20010723 Worked! Though libstdc++-v3, EH, F77 seems non-working
20010725 Missing sgidefs.h included from libstdc++-v3/include/mips-elf/bits/atomicity.h
20010727 -"-
mn10200-elf mn10200-sim 20010725 ICE compiling libgcc2.c:_ffsdi2
20010725 -"-
20010727 -"-
mn10300-elf mn10300-sim 20010723 Worked! Though libstdc++-v3, objc seems non-working
20010725 ICE compiling newlib/libm/math/sf_erf.c
20010725 -"-
powerpc-eabisim powerpc-sim Daily build This target is used by the automatic regression tester. It'll complain to you by email if you break it.
sh-hms sh-hms-sim 20010723 ICE compiling libgcc2.c:_muldi3
20010725 ICE compiling newlib/libc/stdlib/ldtoa.c
20010727 -"-
sparclite-elf sparclite-sim 20010723 ICE compiling newlib/libc/stdlib/envlock.c
20010725 -"-
20010727 -"-
v850-elf v850-sim 20010723 Incorrect dependencies building simulator: No rule to make target `../../intl/libintl.a', needed by `gencode'
20010725 -"-
20010727 -"-