在EVC编译CEBetaPlayer 0.0.25版时,在wmv_decode files模块的LINKING阶段出了这样一个WARNING:

Linking...
xilinke44 starting link
Creating library ARMV4IRel/wmv_decode.lib and object ARMV4IRel/wmv_decode.exp
Affine.obj : warning LNK1166: cannot adjust code at offset=0x00001000, rva=0x00001E74
decolorconv_wmv.obj : warning LNK1166: cannot adjust code at offset=0x00001000, rva=0x00029E38

看得我心惊肉跳,cannot adjust code? 某个地址上的编译结果不可识别?这EVC怎么混的,编译出自己不能识别的结果?
关键字在WARNING LNK166上。在EVC4的HELP里面搜索LNK1166,有且仅有的说明为:
LINK was unable to pad the code as required.
Certain instructions are not allowed to cross page boundaries on some processors. LINK attempts to add pads to correct this situation. In this case, LINK could not work around the problem.

不知所云,而且最重要的是,没给出解决方案。谁写的文档,揍他个半身不遂。

当然像我这样的SUPER GOOGLER是没什么找不到的东东啦。答案在这里

Microsoft eMbedded Visual C++ 4.0 SP4  Readme (Online Version)
http://download.microsoft.com/download/a/7/3/a735c7fb-dcbd-429f-9090-d09b3b15d3fa/ReleaseNotes.htm

其中提到
5.2. Linker warning LNK1166: cannot adjust code at offset

Texas Instruments has identified a defect in the ES1, ES2 and ES3 silicon steppings of the OMAP710. It’s also believed (but not yet confirmed) that the same issue will impact all ARM925-based offerings from TI, including the OMAP1510 and OMAP310. This defect can lead to incorrect instruction execution, resulting in an operating system crash. The problem results when a data abort occurs for an instruction at address 0xXXXX:XFF4 of any instruction page and the following page of instructions is not present in the instruction TLB. A data abort, instruction fetch and instruction TLB miss must occur simultaneously for the error to occur. The linker included with eVC compensates for this potential problem by padding the resulting executable to move the hazardous instruction from the specific address. However, in some cases the linker can not handle this automatically and will issue “warning LNK1166: cannot adjust code at offset. To fix those cases, do the following:

Recompile adding the /Gy option to separate functions for the linker and then relink. If any warnings still exists, then 
Rewrite the source code for the large function that generates code larger than a page into several that generate less than one page each. 
The automatic padding can be turned off via the /ARMPADCODE:NO linker switch. However the perf/size impact of the padding is minimal, and we do not recommend turning this off unless you are absolutely sure your application will never run on a chipset with this problem. For most developers, this should be left enabled.

也就是说在TI的ARM925系列CPU上存在一个缺陷,但是他们自己不去FIX掉,却牛B哄哄地让微软给他们擦屁股:在EVC里增加了LINK时的一项PAD CODE功能来防止EVC编译出来的程序在他们CPU里跑着跑着导致死机。微软虽然给了TI一点面子,也不是很卖帐,就没把这个功能做完美,在某些情况就PADDING不起来了,报出了这个WARNING。虽然如此, 文中建议大家还是保留这个功能以防止自己的程序哪天把TI的CPU跑死。

文中给出了两种解决方法:
(1)科学的解决方法:在project settings -> C/C++ TAB -> Category: Customize 里面把 Enable function-level linking 这个复选项勾起来  //结果我发现我的wmv_decode settings这个项上是灰的,不可勾选,哭啊哭啊眼泪哗哗。让我心理平衡的是文中说即使这么操作也有可能WANRING仍然存在.
(2)眼不见为净法:在project settings -> Link TAB -> Project Options 里面加入"/ARMPADCODE:NO"  很坚定地拒绝给TI擦屁股。幸运的是我只盯着INTEL XSCALE,O~O~O~ONLY YOU~~~  所以可以这么做

本文转自Walzer博客园博客,原文链接:http://www.cnblogs.com/walzer/archive/2006/02/09/327834.html,如需转载请自行联系原作者

解决warning LNK1166: cannot adjust code之掩耳盗铃版相关推荐

  1. 解决Warning: Cannot modify header information - headers already sent b...

    解决Warning: require(E:\testwwwroot\cc06\wp-admin/wp-includes/compat.php) [function.require]: failed t ...

  2. 成功解决WARNING: Ignoring invalid distribution -illow (E:\program files\python\python36\lib\site-package

    成功解决WARNING: Ignoring invalid distribution -illow (E:\program files\python\python36\lib\site-package ...

  3. 成功解决WARNING:tensorflow:From :read_data_sets (from tensorflow.contrib.learn.python.learn.

    成功解决WARNING:tensorflow:From :read_data_sets (from tensorflow.contrib.learn.python.learn. 目录 解决问题 解决思 ...

  4. 成功解决WARNING: You do not appear to have an NVIDIA GPU supported by the 430.34 NVIDIA Linux graph

    成功解决WARNING: You do not appear to have an NVIDIA GPU supported by the 430.34      NVIDIA Linux graph ...

  5. 成功解决WARNING:tensorflow:Variable += will be deprecated. Use variable.assign_add if you want assignmen

    成功解决WARNING:tensorflow:Variable += will be deprecated. Use variable.assign_add if you want assignmen ...

  6. 解决 warning C4003: “min”宏的实参不足

    解决 warning C4003: "min"宏的实参不足 使用Qt5.0.1 for ms2010编译一个工程,错误信息如下: d:\qt\qt5.0.1\5.0.1\msvc2 ...

  7. 【npm i 报错解决方法】npm ERR! code ERESOLVEnpm ERR!npm ERR! While resolving: by-web@1.2.2npm ERR!

    [npm i 报错解决方法]npm ERR! code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! np ...

  8. 解决Warning: NEWFF used in an obsolete way. See help for NEWFF to update calls to the new argument li

    解决Warning: NEWFF used in an obsolete way.   See help for NEWFF to update calls to the new argument l ...

  9. 如何解决WARNING C4996问题

    如何解决WARNING C4996问题 在VS编译器中经常会出现warning C4996警告问题,如: warning C4996: 'sprintf': This function or vari ...

最新文章

  1. 如何使用vs来运行box2d中Testbed的案例
  2. Embarcadero Dev C++ 中文输出乱码
  3. Linux权限管理(基本权限、默认权限、
  4. 通过python实现linux切换用户_Python实现在Linux系统下更改当前进程运行用户
  5. 第 6 期 Arthas 征文活动开启!(内附第 5 期获奖名单)
  6. Egret之ProtoBuf(引用)
  7. pytorch 之 分开安装 torch 和 torchvision
  8. UVA - 10168 Summation of Four Primes(哥德巴赫猜想)
  9. 机器学习-预测之时间序列分析预测法原理及实战
  10. dubbo 使用 filter 报错解决
  11. SAP CRM,C4C和Hybris的product Cockpit
  12. SQL Server安全(6/11):执行上下文与代码签名(Execution Context and Code Signing)
  13. 四元素的真面目..........简单粗暴
  14. [html] link标签的属性media有哪些值?都有什么作用?
  15. 《集体智慧编程》笔记(2 / 12):提供推荐
  16. LeetCode 1134. 阿姆斯特朗数
  17. 华为云工业智能体,做智能化最“硬核”
  18. C语言 Mkl 矩阵乘法,MKL库矩阵乘法
  19. torch.nn.Module.named_buffers(prefix=‘‘, recurse=True)
  20. vue中使用web serial api实现串口通信

热门文章

  1. springmvc一:编写简单的HelloWorld
  2. spring二:装配bean(自动装配)
  3. 关于layui-layer独立组件--弹出层
  4. Android组件系列----Activity的生命周期
  5. 恶意软件、Rootkit和僵尸网络
  6. Apache2 之虚拟主机设置指南
  7. PHP的mysqli扩展
  8. 深入理解java虚拟机---读书笔记
  9. 吴恩达“机器学习”——学习笔记六
  10. IOS开发学习记录第5天之C语言学习