relocation truncated to fit: R_ARM_PC24
Tat Kee Tan
tktan@EE.Princeton.EDU
Wed Apr 18 11:31:00 GMT 2001
Sorry, this is a long one.
I am developing an embedded software for StrongARM.
I wish to have my code located at 0x80000000 instead of
0x02000000 which is the default. My code also make call
to some glibc function such as vfprintf().
When I use
arm-linux-ld -Bstatic -dynamic-linker /lib/ld-linux.so.2 -X -m elf32arm -o
usrappl -L/home/tktan/usr/arm/lib/gcc-lib/arm-linux/egcs-2.91.66
-L/home/tktan/usr/arm/arm-linux/lib usrappl.o -lgcc -lc -lgcc -Ttext
0x80000000
I got many errors like
/home/tktan/usr/arm/arm-linux/lib/libc.a(vfprintf.o): In function
`_IO_vfprintf':
/home/tktan/usr/src/glibc-2.1.2/stdio-common/vfprintf.c:1562: relocation
truncated to fit: R_ARM_PC24 _pthread_cleanup_pop_restore
So, I tried just the default
arm-linux-ld -Bstatic -dynamic-linker /lib/ld-linux.so.2 -X -m elf32arm
-o usrappl -L/home/tktan/usr/arm/lib/gcc-lib/arm-linux/egcs-2.91.66
-L/home/tktan/usr/arm/arm-linux/lib usrappl.o -lgcc -lc -lgcc
arm-linux-objdump -dS usrappl > usrappl.dis
and look at usrappl.dis I found this
.
.
.
20007e8: 03a05000 moveq r5, #0
20007ec: 13e05000 mvnne r5, #0
20007f0: e1a00004 mov r0, r4
20007f4: eb0034b4 bl 200dacc <__internal_funlockfile>
20007f8: e3560000 cmp r6, #0
20007fc: 124b0028 subne r0, fp, #40
2000800: 13a01000 movne r1, #0
2000804: 1b7ffdfd blne 4000000 <_end+0x1fc12ec>
2000808: e1a00005 mov r0, r5
200080c: e91ba870 ldmdb fp, {r4, r5, r6, fp, sp, pc}
2000810: 00000000 andeq r0, r0, r0
2000814: 0200dacc andeq sp, r0, #835584
at 2000804 a branch is made to 0x04000000 which is out of range if the
section start at 0x80000000
The Question Is : Why does glibc need to branch to such an absolute
address ? Looking at the source code, this branch seems to originate
from a
__libc_cleanup_region_end (0);
call at the end of vfprintf()
tatkee
More information about the Binutils
mailing list