在mips平台编译时遇到此问题
解决办法是 在编译中加入 -mxgot 加入后编译通过
原因:
根据binutils资源 R_MIPS_GOT_DISP 在64位mips上有16位的限定 GCC文件也提到了: | '-mxgot' | '-mno-xgot' | Lift (do not lift) the usual restrictions on the size of the global | offset table. | | GCC normally uses a single instruction to load values from the GOT. | While this is relatively efficient, it only works if the GOT is | smaller than about 64k. Anything larger causes the linker to | report an error such as: | | relocation truncated to fit: R_MIPS_GOT16 foobar | | If this happens, you should recompile your code with '-mxgot'. | This works with very large GOTs, although the code is also less | efficient, since it takes three instructions to fetch the value of | a global symbol.