[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] Meaning of "relocation truncated to fit:R_AVR_13_PCRE

From: Bill Roy
Subject: Re: [avr-gcc-list] Meaning of "relocation truncated to fit:R_AVR_13_PCREL"?
Date: Wed, 25 Feb 2009 14:56:24 -0700

Bob, I have run into the same problem and am standing by for the fix. I can offer a couple ugly tricks that might keep you going for a few days until the fix is available.

The specific problem you hit might be fixed by forcing -lc and -lm into the link command stream early on, in order to force 'exit()' to be linked before it is so far away that it triggers the bug. I have also found that by jiggling the load order of the .o files I can prevent many of these.

The result is a makefile that ends up looking like hamburger but it gets the job done:

main.elf: $(OBJECTS)
        $(COMPILE) -o main.elf usbdrv/usbdrvasm.o main.o \
        bitlash-arduino.o \
        bitlash.o -lc -lm \
        bitlash-program.o \
        bitlash-functions.o -lc -lm \
        bitlash-eh1.o \
        bitlash-error.o -lc -lm \
        bitlash-cmdline.o \
        bitlash-taskmgr.o \
        bitlash-parser.o \
        bitlash-interpreter.o \
        eeprom.o \
        bitlash-serial.o \
        bitlash-eeprom.o \

You may also find it useful in the interim to turn off working stuff to make other stuff linkable to debug. My Bitlash build is near 8000 bytes so you can get quite a distance by fiddling like this. Meanwhile we wait in hope.

Let us all cross our fingers and hope that Murphy smiles on the maintainers for long enough that the release is expeditious and painless :)



On Feb 25, 2009, at 12:57 PM, Weddington, Eric wrote:

-----Original Message-----
org] On Behalf Of Bob Paddock
Sent: Wednesday, February 25, 2009 12:41 PM
To: avr-gcc-list
Subject: [avr-gcc-list] Meaning of "relocation truncated to

What does this error mean?:

relocation truncated to fit: R_AVR_13_PCREL against symbol `exit'
defined in .fini9 section in g:/winavr~4/bin/../lib/gcc/avr/4.3.2 \
make[1]: *** [LT_A.elf] Error 1
make: *** [all] Error 2

There is no 'exit' in my code; _exit() exits from Main, have not added
OS_Main yet.

Seems code size related.
4420 bytes fit before the error triggers.

Yeah, it took me a while to figure this one out, but I finally did recently. FYI, you also ran into a bug that has now been fixed, but not yet released.

The R_AVR_13_PCREL relocation is typically where a rjmp/rcall is not working due to total code size. The "13_PCREL" part means a 13-bit relative to PC. RJMP/RCALL can address +/- 2K words, hence 8K bytes total range and 2^13 = 8K.

You're using tiny88 which is avr25 architecture. There was a bug recently in binutils, where it wasn't probably doing the wraparound for this relocation because the avr25 arch was forgotten to be added to a list. This is fixed now and will be in the next WinAVR release.

I'm trying to get a WinAVR RC out this week. We should see if that helps your situation.

Eric Weddington

AVR-GCC-list mailing list

reply via email to

[Prev in Thread] Current Thread [Next in Thread]