| Author |
Message |
|
|
Posted: Jun 17, 2011 - 04:28 AM |
|

Joined: Apr 15, 2011
Posts: 13
Location: Sydney, Australia
|
|
My application compiled and run OK with the WinAVR 20081205, then I update to version 20100110.
I am getting these errors:
Quote:
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(isspace.o): In function `isspace':
(.text.avr-libc+0x2): relocation truncated to fit: R_AVR_13_PCREL against symbol `__ctype_isfalse' defined in .text.avr-libc section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(cty_isfalse.o)
c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(fp_powsodd.o): In function `__fp_powsodd':
(.text.avr-libc.fplib+0x16): relocation truncated to fit: R_AVR_13_PCREL against symbol `__fp_powser' defined in .text.avr-libc.fplib section in c:/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr6\libc.a(fp_powser.o)
and some more
Any clue what went wrong?
Thanks.
Teddy |
|
|
| |
|
|
|
|
|
Posted: Jun 17, 2011 - 05:38 AM |
|

Joined: Dec 16, 2005
Posts: 3097
Location: Bratislava, Slovakia
|
|
Now you DID use -relax, right?
JW |
|
|
| |
|
|
|
|
|
Posted: Jun 17, 2011 - 12:13 PM |
|

Joined: Apr 15, 2011
Posts: 13
Location: Sydney, Australia
|
|
Sorry, I don't know how or where to check or set that -relax option.
Could you please explain it?
Thanks. |
|
|
| |
|
|
|
|
|
Posted: Jun 17, 2011 - 06:24 PM |
|


Joined: Jul 18, 2005
Posts: 62952
Location: (using avr-gcc in) Finchingfield, Essex, England
|
|
| You ned to link with libm.a, that is "-lm" to the linker |
_________________
|
| |
|
|
|
|
|
Posted: Jun 17, 2011 - 07:54 PM |
|


Joined: Dec 21, 2006
Posts: 1551
Location: Saar-Lor-Lux
|
|
avr-libc contains RCALL/RJMP instructions to extern functions for devices >= 16K and hopes for the best: that offsets will be small enough to fit into RJMP/RCALL.
However, if there is much code (maybe drawn from avr-libc), offsets can get too big as to fit and the linker truncates them. The resulting code will crash because jump target addresses are incorrect.
Linking against libm might help to get smaller code so that the offsets fit again. But that is not bullet proof, see
http://lists.gnu.org/archive/html/avr-g ... 00022.html
Linker relaxing might help in some corner cases (because, again, it might lead to smaller code and offset fits).
But linker can only relax from JMP/CALL to RJMP/RCALL, not the other way round because increasing code might exceed branch offsets. |
|
|
| |
|
|
|
|
|
Posted: Jun 18, 2011 - 01:10 PM |
|

Joined: Dec 16, 2005
Posts: 3097
Location: Bratislava, Slovakia
|
|
Indeed, this has nothing to do with -relax and is result of linker moving the library functions around in a strange, illogical way. Funny, this does not happen with my favourite 2007-vintage WinAVR stuff.
Any reason why does the linker do this?
Any way how to influence this behaviour of linker?
Jan |
|
|
| |
|
|
|
|
|
Posted: Jan 05, 2012 - 12:46 AM |
|

Joined: Jan 04, 2012
Posts: 1
|
|
Had a really long day looking for an answer to my problem and the -relax tip did it for me, linking with libm.a made no difference. Thanks a lot!!! I just hope the solution lasts as my project grows. If it is of help to anybody I am using AVR Studio 5 and I checked the "Relax Branches (-mrelax)" box under Project>Properties>Toolchain>AVR/GNU C++Linker>Optimization.
Johnny |
|
|
| |
|
|
|
|
|