relocation truncated to fit -- g++ 3.4.3 -- atmega168

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm getting a linking error ( below ) using g++ 3.4.3 with an ATMega168.

I can make the source compile or not compile by commenting out a line equivalent to 'f+=10.0' where f is a float.

The thread below mentions a similar ( or same ) bug but the bug was closed long ago.

https://www.avrfreaks.net/index.p...

Any thoughts? What can I provide to help debugging?

The linker version is 2.15.

Thanks,

-Dan

Linking: controller.elf
avr-g++ -mmcu=atmega168 -I. -gstabs -DF_CPU=11059200UL -DUART_RX_BUFFER_SIZE=128 -DUART_TX_BUFFER_SIZE=16 -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wa,-adhlns=controller.o -I../hal -I/home/bu/include/avr -I/home/bu/include/avr/procyon -MD -MP -MF work/.dep/controller.elf.d controller.o ../hal/serial.o ../hal/uart/uart.o /home/bu/src/avr/procyon/cmdline.o /home/bu/src/avr/procyon/encoder.o --output controller.elf -Wl,-Map=controller.map,--cref -lm
/usr/lib/gcc/avr/3.4.3/../../../../avr/lib/avr5/libm.a(exp.o)(.text.fplib+0x36): In function `exp':
../../../../libm/fplib/exp.S:87: relocation truncated to fit: R_AVR_13_PCREL no symbol
/usr/lib/gcc/avr/3.4.3/../../../../avr/lib/avr5/libm.a(log.o)(.text.fplib+0x3e): In function `log':
../../../../libm/fplib/log.S:111: relocation truncated to fit: R_AVR_13_PCREL no symbol
make: *** [controller.elf] Error 1

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

That's a genuine bug, caused by the way fplib is written. They use
RJMPs and RCALLs to divert to other parts of the FP library, but it's
not guaranteed the linker would link all related functions
contiguously.

Please fill out a bug report at

https://savannah.nongnu.org/bugs/?group=avr-libc

I can imagine of a way how to fix that, but it will be a bit of work.
In case I've got a fix, would you be willing to try that (which means
to extract a new binary archive of avr-libc on top of your
installation)?

Jörg Wunsch

Please don't send me PMs, use email if you want to approach me personally.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi Jorg, ( don't know how to make the umlaut ) :)

I switched back to avr-gcc from avr-g++ and the code shrank dramatically ( more than the usual one or two hundred byte difference ). It also seems to have fixed the relocation issues.

Definitely something strange going on. I can switch back and forth easily ( now that I uglified my code to make it C compliant ). If you post a fix, I will definitely test it out.

I'll fill out a bug report now.

Thanks,

-Dan