gcc: Undefined references while linking

CJ carjay@gmx.net
Mon Sep 23 10:43:00 GMT 2002


Hi,

I'm using:
binutils 2.13, gcc 3.2 and newlib 1.10.0
on a Win2K Cygwin environment and I'm trying to compile for a m68k-coff 
target.
I also suffered from several mysterious errors while trying to build the 
compiler but after removing libgloss from newlib it seemed to work, I 
installed and was now trying to compile and link my first test "routine".

int main (){return 0;}

The compiling stage is finished but if I try to link I get a lot of errors:

$ /m68k/bin/m68k-coff-gcc -mcpu32 -o test.x test.o
/m68k/lib/gcc-lib/m68k-coff/3.2/mcpu32/libgcc.a(__main.o):
In function `__do_global_dtors': 
/usr/src/build/gcc/../../gcc-3.2/gcc/libgcc2.c:1900: undefined reference 
to `__EH_FRAME_BEGIN__'
/m68k/lib/gcc-lib/m68k-coff/3.2/mcpu32/libgcc.a(__main.o):
In function `__do_global_ctors': 
/usr/src/build/gcc/../../gcc-3.2/gcc/libgcc2.c:1916: undefined reference 
to `__EH_FRAME_BEGIN__'
/m68k/lib/gcc-lib/m68k-coff/3.2/../../../../m68k-coff/lib/mcpu32/libc.a(abort.o):
 In function `abort': 
/usr/src/build/m68k-coff/mcpu32/newlib/libc/stdlib/../../../../../../gcc-3.2/newlib/libc/stdlib/abort.c:63: 
undefined reference to `_exit'
/m68k/lib/gcc-lib/m68k-coff/3.2/../../../../m68k-coff/lib/mcpu32/libc.a(signalr.o): 

In function `_kill_r': 
/usr/src/build/m68k-coff/mcpu32/newlib/libc/reent/../../../../../../gcc-3.2/newlib/libc/reent/signalr.c:61: 
undefined reference to `kill'
/m68k/lib/gcc-lib/m68k-coff/3.2/../../../../m68k-coff/lib/mcpu32/libc.a(signalr.o): 

In function `_getpid_r': 
/usr/src/build/m68k-coff/mcpu32/newlib/libc/reent/../../../../../../gcc-3.2/newlib/libc/reent/signalr.c:96: 
undefined reference to `getpid'
/m68k/lib/gcc-lib/m68k-coff/3.2/../../../../m68k-coff/lib/mcpu32/libc.a(sbrkr.o) 
:
In function `_sbrk_r': 
/usr/src/build/m68k-coff/mcpu32/newlib/libc/reent/../../../../../../gcc-3.2/newlib/libc/reent/sbrkr.c:60: 
undefined reference to `sbrk'
collect2: ld returned 1 exit status

Funny enough this is exactly the same problem that occurs when I try to 
build libgloss.
I examined the mentioned source files and it seems that f.ex. the 
"_exit"-routine is supposed to be provided by the OS. My target will be 
a satellite receiver with no OS (I plan to implement that on a very very 
low level since there is only 1 MB of ROM space ;) ).

So I guess I have to provide some stubs or at least my own idea of an 
implementation, but how and where do I do that?
My forgiveness if a RTFM could cure this. ;)

Carsten


------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com



More information about the crossgcc mailing list