relocation truncated to fit: R_MIPS_GOT_DISP against * 问题

在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.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值