Fix for busybox's df

Amadeus amadeus at iksw-muees.de
Fri Sep 29 21:25:21 CEST 2006


On Friday 29 September 2006 20:57, Daniele Forsi wrote:
> there is __divdi3
>
>  304:   ebfffffe        bl      0 <__divdi3>
>
> I've found the previuos threads, how can I help?

I have taken the current RAM-DEVEL build, enabled the BUSYBOX DF 
command, and compiled.

There is a file df.o, with a "bl 0 <__divdi3>". The traget of the call 
is to be filled in by the linker:

In the file "busybox", I found the start of __divdi3 at 30A08.

There are calls to the macro count_leading_zeros, which is using a table 
of constants. Code sequence:

mov	r1, r6, lsr r3
ldr	r2, [pc, #....] 0x30F8C
ldrb	r3, [r2, r1]	<<<< boom!

At address 30F8C, there is the value 33F0C. This is not the address of 
the constant table, the constant table is at 33F4C. I suspect the 
difference of 0x40 is the busybox binary header size, so all seems to 
be OK there.

However, in the file dslinux.nds, I found the address of the pointer to 
the constant table to be in 0x1E6BB0.

The pointer to the constant table is 33F0C!

So the error is that the binding process which put all programs together 
and do the final relocation, does NOT relocate this special pointer to 
the constant table in count_leading_zeros.

Can someone with linking experience look after this problem?

We hunt this bug several month now!

regards
Amadeus
-- 
We're back to the times when men were men 
and wrote their own device drivers.

(Linus Torvalds)



More information about the dslinux-devel mailing list