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

James Cowgill <[email protected]>
Newsgroups gmane.linux.debian.ports.mips
Message-ID <[email protected]>
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
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAEBCgAdFiEE+Ixt5DaZ6POztUwQx/FnbeotAe8FAlgyAW4ACgkQx/Fnbeot
Ae+qSQ/5AUlMdJ45oU+RiVM9K5+HXcRDG0ntIOABW2hAjYPJKQlVKXRgkNGv64P0
G2zDILzg7K0ZFyvYksHFqSMEDsp9mya0GzzycwYW3o6VXSNZ+CVSgKyqwp0Utw+X
chODvElijpwgOtAJSDI8m1POnNqYjsp1m8Me6ZmLk1oY/MpRSoA0q9g91M3DsV80
AGSo5bibI/gVqu+GfTH8sMnJ3KzKwMWrm6OmRvhSpwGX58qBwnL+9bobL+zEVAXD
QwAQ2ArPOrCQtgQn5whY7SxyLLPV1KXC2j/IHVNBUOsTqWG4c2ZQp2vC4Y1pxNrN
oBSlKACaZAwfOXGzYWaBoALvnxddZgaKgrZRx20y0j/Ss/SgQZhab/LOm1WlQ88A
gU4NSZUXkGvoKmVM0EBkRu7f5u3INp7UL9GSycZGUr1ZlrCv1VVTHCQZBAnQtLJR
Ly6V3TzpLJVqr6PbVRGpYqZ1qkr9jUqS6AS8JAFyhQPvJrevPeGiKQpiwl1j2++H
VzNFQDxea2MgB3234az979HFzAdhlrzxHA6yLb3+xV/RK3e16EOvOupnJxeBL4QC
LWPW3zuWLvMtWLrmC2mHwFQA18daY8FozTeCUaciyauqVa986mZ7TC+R4rILtuKr
eiwcv78FQ9t1fz3oqjcrIEnJgtUpGTkNYhOp1PmK8gPb0Y3+fCw=
=KNMy
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.