Hi,

I have recognized that the snapgear arm toolchain
(arm-linux-tools-20061213.tar.gz) doesn't use -msingle-pic-base in
libgcc.a. Some of the library function use the global offset table. For
example, __divdi3 calculates the pic base with

ldr     sl, [pc, #<some-offset>]
add     sl, pc, sl

which is obviously wrong. sl will point to the end of the text section,
but the data section (where sl should point to) doesn't follow the text
section. This test program uses __divdi3, and will fail:

#include <stdio.h>

long long a,b;
int i;

int main()
{
    a=100;b=3;
    i=a/b;
    printf("res: %d\n",i);
}

Obviously, -fpic must always be used together with -msingle-pic-base to
prevent wrong code, including the libgcc build.

Regards,
Erwin




_______________________________________________
uClinux-dev mailing list
[email protected]
http://mailman.uclinux.org/mailman/listinfo/uclinux-dev
This message was resent by [email protected]
To unsubscribe see:
http://mailman.uclinux.org/mailman/options/uclinux-dev

Reply via email to