编译时出现如下错误
(.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. TheRETW
andRETW.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.
您有两种选择来解决此问题:
- 您可以尝试调整代码的加载基地址和/或使其更小 (!) 直到它适合 1GB 区域以修复它。
- 如果这不起作用或不是一个选项,您将不得不使用支持替代 CALL0 ABI 的编译器重新编译在您的 Xtensa 系统上运行的一切,它处理寄存器文件作为“平面”,从而避免了有问题的窗口调用和返回指令。
关于linker-errors - Xtensa --- 危险重定位 : windowed long call crosses 1GB boundary,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31049837/