This is the mail archive of the binutils@sources.redhat.com mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

arm-elf-ld: problems with long calls in thumb mode


Hi,

I'm working on a platform with an arm7tdmi chip with a large (but slow)
flashrom and a small, fast sram. Code is in thumb mode. The flashrom is used to store collected data as well as providing non-volatile storage for the program code. On bootstrap, all code is copied from flash to ram because speed is of essence. This works as intended.


However, I'm getting to the point where I'm running out of ram and I would like to skip copying non-critical functions to ram in order to save some space and here I experience problems with the linker:

thumb/send.o(.text+0x10): In function `InitRS232':
send.c:39: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0x20):send.c:40: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0x58): In function `SendData':
send.c:71: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r4
thumb/send.o(.text+0x60):send.c:72: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r4
thumb/send.o(.text+0x6a):send.c:76: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0x7a):send.c:79: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r4
thumb/send.o(.text+0x8c):send.c:82: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0xa0):send.c:83: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r4
thumb/send.o(.text+0xa6):send.c:85: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0xda):send.c:103: relocation truncated to fit: R_ARM_THM_PC22 _call_via_r3
thumb/send.o(.text+0xea):send.c:106: additional relocation overflows omitted from the output


I have looked for information regarding this behaviour and I've seen
that other people have also run into similar situations, but I haven't
found a solution. The problem seems to be that the 'bl' instruction can't bridge the gap between flash and ram so the linker tries to use the _call_via_rX routines as intermediates. However, these routines are in libgcc which are linked only to the ram address which means they too are unreachable from flash! Is there anyway to get the linker to smarten up and place these routines in flash as well as in ram so that functions can be called from either place?



Thanks, /Lars


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]