linker-errors - Xtensa --- 危险重定位 : windowed long call crosses 1GB boundary

标签 linker-errors ld relocation xtensa

编译时出现如下错误

(.sram.text+0x1283): dangerous relocation: windowed longcall crosses 1GB boundary; return may fail: (UND+0xdeadcafe)

在其中一个函数中。

架构是 Xtensa,使用的工具链是为 Xtensa 构建的 GNU 工具链。此错误在 binutils 源代码中文件 elf32-xtensa.c 中的函数 elf_xtensa_do_reloc() 内。

请让我知道此错误的原因和任何可能的解决方案。

最佳答案

这是默认 Xtensa 窗口寄存器 ABI 的已知警告。引用 Xtensa ISA reference manual :

The window increment stored with the return address register in a4 occupies the two most significant bits of the register, and therefore those bits must be filled in by the subroutine return. The RETW and RETW.N instructions fill in these bits from the two most significant bits of their own address. This prevents register-window calls from being used to call a routine in a different 1GB region of the address space.

您有两种选择来解决此问题:

  1. 您可以尝试调整代码的加载基地址和/或使其更小 (!) 直到它适合 1GB 区域以修复它。
  2. 如果这不起作用或不是一个选项,您将不得不使用支持替代 CALL0 ABI 的编译器重新编译在您的 Xtensa 系统上运行的一切,它处理寄存器文件作为“平面”,从而避免了有问题的窗口调用和返回指令。

关于linker-errors - Xtensa --- 危险重定位 : windowed long call crosses 1GB boundary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31049837/

相关文章:

c++ - 尝试编译使用共享库的 C++ 程序时出错

iphone - iPhone上的SQLite,奇怪的链接错误

c - 如何从目标文件生成纯二进制文件?

c - 为什么我要在同一个链接器调用中两次传递 obj 文件?

c++ - 使用 MSVC2010 在动态 QT 中使用 RegOpenKey 和 RegEnumKey

ios - 链接器错误,但仅限于测试文件

c++ - 如何使用 ld 创建共享库?

c - 重定位错误

llvm - 与 LLD 链接时禁用重定位

perl - ActivePerl 在安装过程中遇到 "relocates"文件时在做什么?