problem while building arm vfp softfloat gcc
Richard Earnshaw
rearnsha@arm.com
Fri Feb 6 17:17:00 GMT 2004
> add <addsub@eyou.com> wrote:
> > I'm building a arm-linux-gcc toolchain with soft-vfp support by
> > crosstool-0.27(Thanks to Dan). But generated code cannot execute
> > "printf("%f",1.00)" well, it will output 0.00000.
> >
> > Then I found gcc doesn't produce right code, it uses wrong registers sequence
> > to pass float argument to function()
>
> Richard Earnshaw wrote:
> > To the best of my knowledge the only configuration of a released version
> > of gcc that supports soft-vfp is arm-netbsdelf.
>
> He's using a patch that adds that, I think.
Ah! OK, lets take a closer look at the test case.... Hmm, it's broken:
It passes a float to a function that's declared without a prototype, and
it returns a value from a void function...
Let's fix up the problems...
$ cat foo.c
float foo(float);
int main()
{
float i=1.0;
foo(i);
return 0;
}
float foo( float i )
{
return i;
}
$ cat foo.s
main:
@ args = 0, pretend = 0, frame = 4
@ frame_needed = 0, uses_anonymous_args = 0
str lr, [sp, #-4]!
sub sp, sp, #4
ldr r3, .L2 @ float
str r3, [sp, #0] @ float
ldr r0, [sp, #0] @ float
bl foo
mov r3, #0
mov r0, r3
add sp, sp, #4
ldmfd sp!, {pc}
Yep, that looks right to me.
R.
------
Want more information? See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com
More information about the crossgcc
mailing list