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]

problem while building arm vfp softfloat gcc


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()
for example, here is my foo.c
-----   begin
void main()
{
        float i=1.0;
        foo(i);
}
void foo( float i )
{
        return i;
}
-----  end

here is foo.s produced by arm-linux-gcc -S foo.c -o foo.s
--------   begin
main:
        @ args = 0, pretend = 0, frame = 4
        @ frame_needed = 1, uses_anonymous_args = 0
        mov     ip, sp
        stmfd   sp!, {r4, fp, ip, lr, pc}
        sub     fp, ip, #4
        sub     sp, sp, #4
        ldr     r3, .L2 @ float
        str     r3, [fp, #-20]  @ float
        ldr     r0, [fp, #-20]  @ float
        bl      __extendsfdf2
        mov     r4, r1
        mov     r3, r0
        mov     r1, r4           /* this line wrong -by addsub*/
        mov     r0, r3           /* this line wrong -by addsub*/
        bl      foo
        ldmea   fp, {r4, fp, sp, pc}
.L3:
        .align  2
.L2:
        .word   1065353216
        .size   main, .-main
        .align  2
        .global foo
        .type   foo, %function
foo:
        @ args = 0, pretend = 0, frame = 4
        @ frame_needed = 1, uses_anonymous_args = 0
<sniz>
---------- end

the two lines asm code before "bl foo" is wrong, it should be:
mov	r2, r3
mov	r3, r4

I'm not a expert of gcc, so anybody can point out which file in gcc source
tree generate the "mov" codes before "bl foo"? I need to find a place to begin
my adventure into gcc.

	
 





--http://www.eyou.com
--Îȶ¨¿É¿¿µÄµç×ÓÐÅÏä  ÓïÒôÓʼþ  Òƶ¯ÊéÇ©  ÈÕÀú·þÎñ  ÍøÂç´æ´¢...ÒÚÓÊδ¾¡

--http://vip.eyou.com
--¿ì¿ìµÇ¼ÒÚÓÊVIPÐÅÏä  ×¢²áÄúÖÐÒâµÄÓû§Ãû



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