And now what???
Brendan J Simon
Brendan.Simon@ctam.com.au
Sat Apr 1 00:00:00 GMT 2000
Stephane Dalton wrote:
> Hi everybody,
>
> I cross compiled gcc-2.95.2, binutils 2.9.1and newlib 1.8.2 for
> m68k-psos-elf. After a bit of working everything installed fine. Now I want
> to build a simple application.
>
> But when linking I get these messages...
>
> /usr/local/m68k-psos-elf/bin/ld: warning: cannot find entry symbol _start;
> defaulting to 80000074
> /usr/local/m68k-psos-elf/lib/crt0.o(.text+0x2): undefined reference to
> `__stack'
> /usr/local/m68k-psos-elf/lib/crt0.o(.text+0x38): undefined reference to
> `hardware_init_hook'
> /usr/local/m68k-psos-elf/lib/crt0.o(.text+0x48): undefined reference to
> `software_init_hook'
> /usr/local/m68k-psos-elf/lib/crt0.o(.text+0x58): undefined reference to
> `__FINI_SECTION__'
> /usr/local/m68k-psos-elf/lib/crt0.o(.text+0x64): undefined reference to
> `__INIT_SECTION__'
> /usr/local/m68k-psos-elf/lib/libc.a(exit.o): In function `exit':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/stdlib/../../../../../ne
> wlib-1.8.2/newlib/libc/stdlib/exit.c:70: undefined reference to `_exit'
> /usr/local/m68k-psos-elf/lib/libc.a(sbrkr.o): In function `_sbrk_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/sbrkr.c:61: undefined reference to `sbrk'
> /usr/local/m68k-psos-elf/lib/libc.a(makebuf.o): In function `__smakebuf':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/stdio/../../../../../new
> lib-1.8.2/newlib/libc/stdio/makebuf.c:93: undefined reference to `isatty'
> /usr/local/m68k-psos-elf/lib/libc.a(writer.o): In function `_write_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/writer.c:58: undefined reference to `write'
> /usr/local/m68k-psos-elf/lib/libc.a(closer.o): In function `_close_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/closer.c:53: undefined reference to `close'
> /usr/local/m68k-psos-elf/lib/libc.a(fstatr.o): In function `_fstat_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/fstatr.c:61: undefined reference to `fstat'
> /usr/local/m68k-psos-elf/lib/libc.a(lseekr.o): In function `_lseek_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
> /usr/local/m68k-psos-elf/lib/libc.a(readr.o): In function `_read_r':
> /usr/src/build-newlib-68k/m68k-psos-elf/newlib/libc/reent/../../../../../new
> lib-1.8.2/newlib/libc/reent/readr.c:58: undefined reference to `read'
> collect3: ld returned 1 exit status
>
> I read from the crossgcc FAQ that sbrk write close read lseek... etc can be
> defined as empty stubs... ok but where do I do that??? and what am I suppose
> to do with hardware_init_hook??
>
> I'm sure it's very simple but I'm a bit loss in that, I took a quick look at
> the crt0.S of libgloss for my architecture but didn't find any clues there.
>
> If anybody can give me some pointers where to go from there it would be
> deeply appreciated.
There should be answers in the mail archives. I've posted similar answers
before.
Search for "-mads" which is a board supported by the powerpc targeted compiler.
My powerpc-eabi compiler would not link unless I gave it the -mads option.
Looking at the specs file I found that -mads causes the linker to link in
libads.a. If you look in libgloss you will see a board support package for the
ads board. This gets compiled and put into the appropriate library directory.
You have two options.
1) Choose a board support package from libgloss which most closely resembles your
hardware. The copy it to a new directory (eg. mybsp) and change the makefiles
and source files to build your own board support package. Install mybsp and add
-mmybsp options to the specs file. Your programs should link if you specify
-mmybsp. Alternatively you can make -mmybsp the default in the specs file so you
don't have to specify it on the gcc command line.
2) Choose a board support package from libgloss which most closely resembles
your hardware. Modify the source code to suit your hardware, build and install
it. Specify -m(the-bsp-you-chose) and it should link. Alternatively you can
make -m(the-bsp-you-chose) the default in the specs file so you don't have to
specify it on the gcc command line.
Hope that helps,
Brendan Simon.
------
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