c++ - 重定位值不适合 24 位

标签 c++ gnu vxworks

我尝试使用 vxWorks 函数 loadModule 将代码文件加载到内存中,但它给了我错误:

Relocation value does not fit in 24 bits

我试图在我的编译器中添加 -mlongcall 标志,但它不起作用。

最佳答案

我在使用 PowerPC 架构之前就见过这个错误。假设您在类似的环境中工作,则问题必须具体与系统中的内存量和相关分支指令的范围有关。

阿贡国家实验室有一个 webpage detailing their experiences with the same issue .以下摘录解释了相对分支寻址的问题:

The PowerPC relative branch instruction is limited to jumps between +/- 32MB of the current instruction (24 bits = +/- 4M instructions, 4 bytes per instruction = +/- 32MB). Unfortunately the vxWorks kernel gets put into the bottom end of RAM, but it loads all application code at the top end. If the two are separated by more than 32MB (should you have 64MB or more on board) then when it tries to load the application code those calls that use these relative branch instructions to vxWorks routines can't be resolved within 24 bits, and the loader prints the message you're seeing.

在阿贡国家实验室,针对此问题的建议修复是在启用 -mlongcall 标志的情况下重新编译加载的模块。

您最初的问题表明此标志不能解决您的问题。 gnu 标志已设置,但没有为您的编译器列出更多信息。鉴于我只能建议您检查编译器文档并验证 -mlongcall 标志是否有效。

假设支持该标志,这可能是由链接库引起的,该链接库本身未使用 -mlongcall 标志编译。 ComplexIT 上的一篇文章详细介绍了一个类似的问题,也是在 PowerPC 架构中,使用 QT。为了解决该问题,需要重建所有库,包括 QT。

关于c++ - 重定位值不适合 24 位,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7378376/

相关文章:

multithreading - VxWorks 是否支持 OpenMP?

c++ - 奇变量赋值

c++ - Clang C++ 交叉编译器 - 从 Mac OS X 生成 Windows 可执行文件

c++ - 将 vector 传递给cpp中的多个文件

bash - GNU 并行将多个文件的输出合并为一个。为什么?

parallel-processing - Gnu parallel 用于复制大量数据(大约 40 GB)

c - gmtime_r 和 localtime_r() 在 vxworks 上返回相同的结果

c - 如何在vxworks中查找套接字描述符的状态

c++ - 预先优化 Lua 脚本并稍后从 C++ 调用它

linux - 在linux中,如何通过GNU ARM汇编进行系统调用