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

Re: Help: build failure due to relocation truncated to fit: R_MIPS_GOT16 and others



Hi,

On 20/11/16 19:59, Steve M. Robbins wrote:
> Thank you James!
> 
> On Sunday, November 20, 2016 7:05:28 PM CST James Cowgill wrote:
> 
>> These relocation errors mean you have too many symbols in the GOT in
>> your executable. MIPS usually uses a single instruction to access the
>> GOT, but that only works for small GOTs. If your GOT is too large, it's
>> still possible to make it work using -mxgot, but it takes 3 instructions
>> to load a 32-bit address, add to the gp register, and do the final load.
>> Since you don't know how the linker will allocate the GOT, you have to
>> use -mxgot on all C/C++ files. The penalty occurs when you access any
>> non-static global functions/variables.
> 
> OK, great!  So just to be certain: it is sufficient to use -mxgot on the project 
> being compiled?  I don't have to worry about the various libraries pulled in?

Yes you should use it on any code which will be in the final executable.
So that includes static libraries, but not shared libraries.

>> Your options are: reduce the number of symbols which span across
>> translation unit boundaries (thus reducing the size of the GOT), or
>> compile with -mxgot on MIPS with a slight speed penalty.
> 
> In this case: it is a test suite, so I expect the speed penalty is acceptable.

Ok.

Thanks,
James

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: