What is "relocation truncated to fit" error means ?

Do you have a question? Post it now! No Registration Necessary

Translate This Thread From English to

Threaded View

I'm using GNU-ld to link my ARM application. I'm using AT91R40008 and
arm-none-eabi-gcc compiler.

I have an error during linking my CRT0.s / C start-up file to my main()
in main.c

The error were like this :
at91r40008_start_gcc.o:
at91r40008_start_gcc.s:281: relocation truncated to fit: R_ARM_PC24
against symbol `main' defined in .text section in MAIN.o

What's happened here ? How do I handle this ?

I already add ".global main" syntax in my C start-up file, so the
linker would recognize the main(), but it doesnt help.

Thank You
-kunil


Re: What is "relocation truncated to fit" error means ?

Quoted text here. Click to load it

Try -fPIC option

cheers
Sagar


Re: What is "relocation truncated to fit" error means ?
Quoted text here. Click to load it

The linker thinks that the branch instruction in your .s file and its
destination are too far apart.  It might think that one is in RAM and the
other in flash, possibly because of errors in the linker script file.

Karl Olsen



Re: What is "relocation truncated to fit" error means ?
Quoted text here. Click to load it

The ARM branch instructions (b, bl) have a 23 bit offset
part in the instruction. If the trasfer target is farther
away from the jump/call then the offset allows, you'll
get the warning (and the code does not work).

Are you attempting to jump into a totally separate
memory segment (from where to where)?

The way to solve the dilemma is to use an indirect
transfer, in C, a function call via a pointer.

Where is your crt0 located and where MAIN?

--

Tauno Voipio
tauno voipio (at) iki fi

We've slightly trimmed the long signature. Click to see the full one.

Site Timeline