title: AVR: Relocation truncated to fit
body: <p>I'm new to this community, in that I've never before created an account and asked a question, but I use this site all the time to solve my programming woes. So thank you! This time, though, I could not find another question matching my exact needs. If this is a repeat, I apologize.</p>
  
  <p>I am on elementary OS 0.2 (Luna), a derivative of Ubuntu 12.04. I am using the avr-gcc library to compile a program for an ATmega32u4 microprocessor. I've compiled this program several times as I developed it, but until now I had not received this error. I'm pasting it below.</p>
  
  <pre><code>/usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr5/libc.a(log.o):../../../libm/fplib/log.S:100: relocation truncated to fit: R_AVR_13_PCREL against symbol `__addsf3' defined in .text section in /usr/lib/gcc/avr/4.5.3/avr5/libgcc.a(_addsub_sf.o)
  /usr/lib/gcc/avr/4.5.3/../../../avr/lib/avr5/libc.a(modf.o):../../../libm/fplib/modf.S:90: relocation truncated to fit: R_AVR_13_PCREL against symbol `__subsf3' defined in .text section in /usr/lib/gcc/avr/4.5.3/avr5/libgcc.a(_addsub_sf.o)
  collect2: ld returned 1 exit status
  make: *** [main.elf] Error 1
  </code></pre>
  
  <p>In short, I have no clue what this refers to. My program contains a multitude of files, so I can't exactly post the whole thing here; instead, I would be interested in a generalized answer to the following questions:</p>
  
  <ol>
  <li>What is a "relocation truncated to fit" error? I've read that it has to do with accessing memory that's too far away, but how does that actually happen within my C program?</li>
  <li>What is R_AVR_13_PCREL? It seems to be inherent to the avr-gcc library; what aspect of my program might refer to such a variable?</li>
  <li>The only general C header I'm including is math.h; the other files are my own. I know there is a funky flag for math.h that should be placed in the Makefile; I believe it is -lm.
  But I've tried this to no avail.</li>
  </ol>
  
  <p>Thank you very much, everyone. I appreciate the help of this community.</p>