This is the mail archive of the
newlib@sources.redhat.com
mailing list for the newlib project.
Re: First time configuring/linking with newlib...
- From: "J. Johnston" <jjohnstn at redhat dot com>
- To: dfowell at intelligentline dot com
- Cc: newlib at sources dot redhat dot com
- Date: Mon, 10 Mar 2003 19:50:40 -0500
- Subject: Re: First time configuring/linking with newlib...
- Organization: Red Hat Inc.
- References: <000201c2e720$5785a020$8100a8c0@RED>
Dan Fowell wrote:
Hi,
I'm trying to link in libc.a that was configured for a powerpc-elf target,
and I must be doing something wrong. Everything seemed to configure/make
correctly for the powerpc-elf target, but when I link in the library as
follows:
powerpc-elf-ld.exe -g -t -Tram.lnk -o main.elf crt0.o main.o -L. -lc
I get the following Linking errors:
---------------------------LINKING OBJS--------------------------
powerpc-elf-ld: warning: no memory region specified for section `.fixup'
powerpc-elf-ld: warning: no memory region specified for section `.got2'
powerpc-elf-ld: address 0x848 of main.elf section .bss is not within region
mem
./libc.a(makebuf.o): In function `__smakebuf':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/stdio/../../../../../ne
wlib-1.10.0/newlib/libc/stdio/makebuf.c:93: undefined reference to `isatty'
./libc.a(sbrkr.o): In function `_sbrk_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/sbrkr.c:60: undefined reference to `sbrk'
./libc.a(writer.o): In function `_write_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/writer.c:58: undefined reference to `write'
./libc.a(closer.o): In function `_close_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/closer.c:53: undefined reference to `close'
./libc.a(fstatr.o): In function `_fstat_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/fstatr.c:62: undefined reference to `fstat'
./libc.a(lseekr.o): In function `_lseek_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/lseekr.c:58: undefined reference to `lseek'
./libc.a(readr.o): In function `_read_r':
/home/DanFowell/build-newlib/powerpc-elf/newlib/libc/reent/../../../../../ne
wlib-1.10.0/newlib/libc/reent/readr.c:58: undefined reference to `read'
powerpc-elf-ld: link errors found, deleting executable `main.elf'
----------------------------------------------------------------------------
what are the "fixup" and "got2" sections for? I don't have those sections
defined in my linker script, but I don't think I want/need them, do I?
Those sections are used for relocation. For powerpc-elf, newlib defaults to
compile all code with the -mrelocatable-lib option.
You can see what the default powerpc-elf linker script does by issuing:
powerpc-elf-ld --verbose
My linker script assigns where the .bss section should be put into region
mem. Is the .bss section of the library fixed?
It appears you have not allocated enough space in your mem region to accomodate
the size of .bss needed.
The undefined reference notifications seem to be related to file handling
related functions, which I don't want/need anyway. Any ideas on how to get
libc.a linking in correctly? All I really want is the sprintf function
(part of stdio.h).
You are missing a libgloss library to supply the low-level syscalls. Try linking
in -lnosys at the end. You will have to provide some sort of _exit routine if you have
not already.
-- Jeff J.