This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.
See the CrossGCC FAQ for lots more infromation.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Shouldn't you be logged as root to do the make all install step? In your compile step: > sh-elf-gcc -ml -Wl,-Ttext,0x8c010000 -nostartfiles -nostdlib -e _main -Wl,-Ttext is telling the linker to use the linker script: 'text', iirc. I don't know what the 0x8c010000 is for. In this step: > ../gcc-2.95.2/configure --target=$target --prefix=$prefix --without-headers > --without-libs --with-cpu=sh4 I wouldn't think --without-libs and --without-headers is necessary, because i've found that the C libs only get included when you #include the relevant header files. In straight C, the crt0.o start-up file calls _main. In C++ iirc, __main and ___main are called to do constructors and destructors, so i think you must be using a C++ start-up file. Using your own start-up one will probably fix it. In /usr/local/crosscompiler/libs, or somewhere around there, you might find a directory called ldscripts. Looking at these will give clues on how to write your own. Dominic Clifton wrote: > > Hi there.. > > I'm tying to get a cross-compiler working so that I can code C programs for > a Sega Dreamcast (Hitachi SH4). > > I downloaded: > > binutils-2.10.tar.gz > gcc-core-2.95.2.tar.gz > > uncompressed them to /usr/src/crosscompiler and then did the following > commands: > > $ target=sh-elf > $ prefix=/usr/local/crosscompiler > $ i=$prefix/bin > $ PATH=$i:$PATH > > $ mkdir build-binutils > $ mkdir build-gcc > > $ cd build-binutils > $ ../binutils-2.10/configure --target=$target --prefix=$prefix > $ make all install > > $ cd ../build-gcc > $ > ../gcc-2.95.2/configure --target=$target --prefix=$prefix --without-headers > --without-libs --with-cpu=sh4 > > Then "vi /gcc/Makefile" and adding "-Dinhibit_libc" to > "TARGET_LIBGCC2_CFLAGS=" > > $ make LANGUAGES="c" all install > > Then I add my new /bin directory with my new binaries to the path > > $ PATH=$i:$PATH > > Then I'm creating a "test.c" file: > > void main ( void) { > } > > Then I compile like this: > > sh-elf-gcc -ml -Wl,-Ttext,0x8c010000 -nostartfiles -nostdlib -e _main > test.c -o test.elf -lgcc > > and it returns: > > test.c: In function `main': > test.c:1: warning: return type of `main' is not `int' > /usr/local/crosscompiler/lib/gcc-lib/sh-elf/2.95.2/ml/libgcc.a(__main.o): In > fuction `__do_global_ctors': > __main.o(.text+0x74): undefined reference to `atexit' > collect2: ld returned 1 exit status > > How do I fix this ? > > I'm guessing I need some form of linker script, but can someone tell me what > I need please ? > > I've been trying to get this to work for a week now, it's driving me mad! > > Dom > > p.s. I downloaded "newlib-1.8.2.tar.gz" and "make"'d that, but the same > thing > happens. (Which I'd of expected anyway..) > > ------ > Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ > Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com -- ******************************************* * Russell Shaw, B.Eng, M.Eng(Research) * * email: russell@webaxs.net * * Australia * ******************************************* ------ Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/ Want to unsubscribe? Send a note to crossgcc-unsubscribe@sourceware.cygnus.com
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |