"relocation truncated to fit: R_MIPS_26 " with gcc 4.1.2 toolchain

dbadhani dbadhani@yahoo.com
Tue Oct 21 00:16:00 GMT 2008


Thanks Andrew.

The problem appeared to be in the way linker script was written. Using
".text.hot"  and ".text.unlikely" instead if "text.hot" and "text.unlikely"
(without a leading ".") fixed the problem. 

-Deven



Andrew Haley wrote:
> 
> dbadhani wrote:
>> Hi Gurus,
>> 
>> I upgraded the gcc toolchain to 4.1.2 and started seeing the following
>> linker errors :
>> 
>> ------------------
>> .
>> .
>> aaa_main.o: In function `main_loop':
>> aaa_main.c:273: relocation truncated to fit: R_MIPS_26 against
>> `process_message'
>> libaaa.a(aaa_soft.ao): In function `increment_stat':
>> stat.c:84: relocation truncated to fit: R_MIPS_26 against
>> `increment_aaa_stat'
>> .
>> .
>> --------------------
>> 
>> Here's an excerpt from the disassembly:
>> -------------------------------
>> Disassembly of section .text:
>> 
>> 00000000 <process_message>:
>>    0: 8c830000 lw v1,0(a0
>> .
>> .
>> .
>> Disassembly of section .text.hot:
>> .
>> .
>> 
>> 000000d8 <main_loop>:
>>   d8: 27bdff60 addiu sp,sp,-160
>>   dc: ffbc0080 sd gp,128(sp
>> -------------------------------
>> 
>> Why is it generating a jump with a 26 bit address (a gap of 64MB)?
> 
> See the section "MIPS Options" in the manual, in particular
> `-mlong-calls'
> 
>> Why is it separating the functions into ".text" and ".text.hot" sections
>> even when I've put the object file "aaa_main.o" explicitly in the ".text"
>> section in the linker script?
> 
> See the docs for `-freorder-functions' in Section 3.10, Options That
> Control Optimization.
> 
> Andrew.
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/%22relocation-truncated-to-fit%3A-R_MIPS_26-%22-with-gcc-4.1.2-toolchain-tp19866719p20081327.html
Sent from the gcc - Help mailing list archive at Nabble.com.



More information about the Gcc-help mailing list