HELP - GCC Cross Compiler: LD Returns "`_atexit` undefined in fuction `__do_global_ctors'"
Dominic Clifton
dom@dsltd.force9.co.uk
Fri Aug 4 23:17:00 GMT 2000
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
More information about the crossgcc
mailing list