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

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: newlib on powerpc-eabi with soft-float



Hi,

Thanks, I used -msoft-float and the linker is now picking up the correct
libc.a (the one in the nof directory). However, I have now come up against
another problem - gcc seems to be picking up the wrong (ie not soft-float)
version of libgcc.a. I create the following dummy C program:

#include <stdio.h>

int start()
{
  printf("Hello World\n");
}
/* Empty functions so satisfy the linker */
int sbrk()   {}
int open()   {}
int close()  {}
int read()   {}
int write()  {}
int isatty() {}
int fstat()  {}
int lseek()  {}

.. and compile it like this:

powerpc-eabi-gcc -o test test.c -msoft-float -lc

However, the linker now complains about a whole load of unresolved symbols:

/usr/toolchain/powerpc-eabi/bin/ld: warning: cannot find entry symbol
_start; defaulting to 01800074
/usr/toolchain/powerpc-eabi/lib/nof/libc.a(vfprintf.o): In function
`_vfprintf_r':
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:592:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:865:

undefined reference to `__eqdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:895:

undefined reference to `__nedf2'
/usr/toolchain/powerpc-eabi/lib/nof/libc.a(vfprintf.o): In function `cvt':
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:972:

undefined reference to `__negdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:992:

undefined reference to `__nedf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdio/../../../../../../newlib-1.10.0/newlib/libc/stdio/vfprintf.c:996:

undefined reference to `__eqdf2'
/usr/toolchain/powerpc-eabi/lib/nof/libc.a(dtoa.o): In function `_dtoa_r':
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:281:

undefined reference to `__eqdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:342:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:342:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:348:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:349:

undefined reference to `__fixdfsi'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:350:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:350:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:350:

undefined reference to `__nedf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:355:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:441:

undefined reference to `__divdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:448:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:450:

undefined reference to `__divdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:454:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:459:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:462:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:468:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:471:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:471:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:471:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:476:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:477:

undefined reference to `__gtdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:479:

undefined reference to `__negdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:479:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:489:

undefined reference to `__divdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:489:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:501:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:502:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:492:

undefined reference to `__fixdfsi'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:493:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:493:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:495:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:497:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:497:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:509:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:512:

undefined reference to `__fixdfsi'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:513:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:513:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:517:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:517:

undefined reference to `__gtdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:519:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:519:

undefined reference to `__ltdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:510:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:547:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:547:

undefined reference to `__ledf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:553:

undefined reference to `__divdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:553:

undefined reference to `__fixdfsi'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:554:

undefined reference to `__floatsidf'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:554:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:554:

undefined reference to `__subdf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:566:

undefined reference to `__adddf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:567:

undefined reference to `__gtdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:567:

undefined reference to `__eqdf2'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:581:

undefined reference to `__muldf3'
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/dtoa.c:581:

undefined reference to `__eqdf2'
/usr/toolchain/powerpc-eabi/lib/nof/libc.a(mprec.o): In function `_ratio':
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/mprec.c:943:

undefined reference to `__divdf3'
/usr/toolchain/powerpc-eabi/lib/nof/libc.a(mprec.o): In function
`_mprec_log10':
/afs/hur/u/jenkinsc/toolchain/build-newlib/powerpc-eabi/nof/newlib/libc/stdlib/../../../../../../newlib-1.10.0/newlib/libc/stdlib/mprec.c:980:

undefined reference to `__muldf3'
collect2: ld returned 1 exit status
make: The error code from the last command is 1.

Stop.


I'm guessing that these functions are replacements for the PowerPC's
floating point instructions. I've checked the libgcc.a file in my gcc
installation's ...../lib/gcc-lib/powerpc-eabi/2.95.3/nof/ directory and the
symbols *are* present in this file so I can only imagine that gcc is using
the wrong libgcc.a.

This problem only occurs when I try to run gcc on my RS/6000 AIX box. When
I run gcc (configured and compiled exactly the same) on a Windows/Cygwin
machine, I don;t get any unresolved symbol problems at all.

Any ideas on what I can do to resolve the problem would be greatly
appreciated.

Cheers,

Chris




Chris Jenkins
IBM UK Laboratories
Chris.Jenkins@uk.ibm.com



                                                                                                                               
                      Peter Barada                                                                                             
                      <pbarada@mail.wm.s        To:       Christopher Jenkins/UK/IBM@IBMGB                                     
                      ps.mot.com>               cc:       crossgcc@sources.redhat.com                                          
                                                Subject:  Re: newlib on powerpc-eabi with soft-float                           
                      01/05/2002 19:04                                                                                         
                      Please respond to                                                                                        
                      Peter Barada                                                                                             
                                                                                                                               
                                                                                                                               




>However, the target processor (MC8260) has no floating point unit and
>I'm not sure whether Newlib is aware of this. Specifically, in
>setjmp.S, there are a few lines of code to save the floating point
>registers (which the MC8260 does not have) wrapped in an #ifndef
>_SOFT_FLOAT.  I'm guessing that _SOFT_FLOAT should be being defined
>somewhere, but I'm not sure where. Is there any option that I can give
>to the configuration script such that this macro will be defined? I'm
>not too keen on hacking the code since I'm sue that there must be
>another way...

If I remember gcc-3.95.3 correctly, the ppc compiler you're build is for
all of the ppc variants out there, both with and without floating point.

If you add '-msoft-float' to both your compilation lines and link
line(using gcc to driver the linker), the compiler won't generate any
FPU instructions, and the library you link with won't use any FPU
instructions.  You could generate a map file (add -Wl,-Map,mapfile to
the gcc line used to link the program) and see which object files from
which libraries were linked.

You should use gcc to driver the linker since it knows how to decipher
-msoft-float and pick the appropriate libraries to pass to the linker.

Good Luck!

--
Peter Barada                                   Peter.Barada@motorola.com
Wizard                                         781-852-2768 (direct)
WaveMark Solutions(wholly owned by Motorola)   781-270-0193 (fax)





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


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