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: where do I get these lib/nof/* files?


David Wuertele wrote:
My CPU has no floating point unit.  I looked around for nof/*, but
didn't find anything.  Any suggestions?


Roman> what sort of cpu is that? is that some kind of embedded system?

Yep: ATI Xilleon (MIPS 4k).

OK mate, here is what i think of this:


roman@athlon1000:~/crosstool/mips-unknown/bin> cat ftest.c
#include <stdio.h>

int main(void) {
    float fnum1=1;
    float fnum2=2;

printf("Result: %f\n", fnum1*fnum2);

    return 0;
}

Compile test program with "-msoft-float" flag, but do not assemble:

roman@athlon1000:~/crosstool/mips-unknown/bin> ./*gcc -msoft-float -S ftest.c
roman@athlon1000:~/crosstool/mips-unknown/bin> mv ftest.s ftest-soft.s


Compile test program with default hard float support, but do not assemble

roman@athlon1000:~/crosstool/mips-unknown/bin> ./*gcc -S ftest.c
roman@athlon1000:~/crosstool/mips-unknown/bin> mv ftest.s ftest-hard.s

Now check the difference between the two assembly files:

roman@athlon1000:~/crosstool/mips-unknown/bin> diff -c ftest-hard.s ftest-soft.s
*** ftest-hard.s Sun Feb 1 13:21:33 2004
--- ftest-soft.s Sun Feb 1 13:21:17 2004
***************
*** 2,7 ****
--- 2,9 ----
.section .mdebug.abi32
.previous
.abicalls
+ .globl __mulsf3
+ .globl __extendsfdf2
.rdata
.align 2
$LC2:
***************
*** 30,46 ****
sw $fp,36($sp)
sw $28,32($sp)
move $fp,$sp
! l.s $f0,$LC0
! s.s $f0,24($fp)
! l.s $f0,$LC1
! s.s $f0,28($fp)
! l.s $f2,24($fp)
! l.s $f0,28($fp)
! mul.s $f0,$f2,$f0
! cvt.d.s $f0,$f0
la $4,$LC2
! mfc1 $7,$f0
! mfc1 $6,$f1
la $25,printf
jal $31,$25
move $2,$0
--- 32,51 ----
sw $fp,36($sp)
sw $28,32($sp)
move $fp,$sp
! lw $2,$LC0
! sw $2,24($fp)
! lw $2,$LC1
! sw $2,28($fp)
! lw $4,24($fp)
! lw $5,28($fp)
! la $25,__mulsf3
! jal $31,$25
! move $4,$2
! la $25,__extendsfdf2
! jal $31,$25
la $4,$LC2
! move $6,$2
! move $7,$3
la $25,printf
jal $31,$25
move $2,$0


I'm not familiar with mips assembly, but from the diff output, it looks like the ftest-soft.s has calls to external subroutines "__mulsf3" and "__extendsfdf2" So we look for shared libraries in our cross lib directory, which define symbol "__mulsf3", for example:

roman@athlon1000:~/crosstool/mips-unknown/mips-unknown-linux-gnu/lib> find ./ -type f -exec /home/roman/crosstool/mips-unknown/bin/mips-unknown-linux-gnu-nm -o {} 2> /dev/null \; | grep '__mulsf3'
./libgcc_s.so.1:00005210 T __mulsf3


So from this i conclude, "libgcc" has provisions for software floating point emulation, but "libgcc" itself depends on "glibc", i.e. if you run "objdump" on "libgcc" you'll see a section:

Dynamic Section:
  NEEDED      libc.so.6
  SONAME      libgcc_s.so.1

Hence, my understanding of this is: when you configure glibc with "--with-fp" or something like that, it will include support for floating point emulation etc, and the final gcc compiler which builds "libgcc" and depends on glibc, will also include support for floating point emulation, without it you'll get an error message:

roman@athlon1000:~/crosstool/alpha-unknown/bin> ./*gcc -msoft-float ftest.c
/tmp/ccz24CuL.o(.text+0x38): In function `main':
: undefined reference to `__mulsf3'
/tmp/ccz24CuL.o(.text+0x50): In function `main':
: undefined reference to `__extendsfdf2'
collect2: ld returned 1 exit status
roman@athlon1000:~/crosstool/alpha-unknown/bin>

But don't take my work for it, try it out yourself, cause i could be wrong, i'm just guessing.

Cheers


------ 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]