This is the mail archive of the newlib@sources.redhat.com mailing list for the newlib project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Math Lib for MIPS


Gerald Stanton wrote:
> 
> Hi,
> 
> I'm a having a bit of trouble trying to resolve the ceil routine from the
> math library.
> 
> I built newlib along with gcc-2.95.2 as follows:
> 
> ../gcc-2.95.2/configure --target=mips-elf --enable-languages=c,c++ --with-gn
> u-as \
> --with-gnu-ld --with-gnu-ar --with-newlib
> 
> The toolchain built successfully and is installed.  The libraries exist and
> running nm on the
> archive does report the presence of ceil.
> 
> What am I doing wrong?
> 
> 
> mips-elf-gcc -v -mcpu=r4k -mips3 -g -lc -lm -lpmon -T pmon.ld -o sam main.o
> vars.o symtab.o parse.o scan.o ./vdiags/vdiags.o symtbl.o vers.o

Archive support is dependent on its position in the command line.  Specify 
-lc -lm -lpmon "after" all of your object files.  When ld gets to your current
specification of -lm,  there are no math routines needed yet.  The linker does
not go back and check previous archive specifications when it finally encounters
a .o which references "ceil".

-- Jeff J.

> Reading specs from /usr/local/lib/gcc-lib/mips-elf/2.95.2/specs
> gcc version 2.95.2 19991024 (release)
>  /usr/local/lib/gcc-lib/mips-elf/2.95.2/collect2 -mips3 -o sam
> /usr/local/lib/gcc-lib/mips-elf/2.95.2/mips3/crtbegin.o
> /usr/local/mips-elf/lib/mips3/crt0.o -L/usr/local/lib/gcc-lib/mips-elf/2.95.
> 2/mips3 -L/usr/local/lib/gcc-lib/mips-elf/2.95.2 -L/usr/local/mips-elf/lib/m
> ips3 -L/usr/local/mips-elf/lib -lc -lm -lpmon main.o vars.o symtab.o parse.o
> scan.o ./vdiags/vdiags.o symtbl.o vers.o -lgcc -lgcc
> /usr/local/lib/gcc-lib/mips-elf/2.95.2/mips3/crtend.o -T pmon.ld
> ./vdiags/vdiags.o: In function `diagTstRdramInit':
> /home/gstanton/dvt/evb/sam2/vdiags/diag_rdram.c:2507: undefined reference to
> `ceil'
> /home/gstanton/dvt/evb/sam2/vdiags/diag_rdram.c:2508: undefined reference to
> `ceil'
> /home/gstanton/dvt/evb/sam2/vdiags/diag_rdram.c:2519: undefined reference to
> `ceil'
> /home/gstanton/dvt/evb/sam2/vdiags/diag_rdram.c:2520: undefined reference to
> `ceil'
> collect2: ld returned 1 exit status
> make: *** [sam] Error 1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]