GreenHills - 小数据区域溢出

发布于 2024-08-31 20:47:11 字数 351 浏览 5 评论 0原文

我希望也许有人对此有一个快速的答案,但本质上当我打开优化时,我收到以下错误:

[elxr](错误)数据区域小 溢出:0xfff9f6fc(有符号)没有 执行时适合 16 位 文件 test_main.o 中的重定位 在位置 __sti___13_test_main_cpp_252229d3+0xc 处,引用符号 oe_init_intconn

当我放入此链接器指令时也会发生类似的错误:

-auto_sda

他们的手册没有提到这个链接器错误。我正在使用 Integrity 5.10

I'm hoping maybe someone has a quick answer for this but essentially when I turn on optimizations, I get the following error:

[elxr] (error) small data area
overflow: 0xfff9f6fc (signed) didn't
fit in 16 bits while performing
relocation in file test_main.o
at location __sti___13_test_main_cpp_252229d3+0xc, to reference symbol oe_init_intconn

A similar error occurs when I put in this linker directive as well:

-auto_sda

Their manual doesn't make any mention of this linker error. I'm using Integrity 5.10

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我的影子我的梦 2024-09-07 20:47:11

此链接器错误通常-Olink优化-auto_sda无关。链接器会看到您的整个程序,并且会尽量避免通过 autoSDAizing 超过 64K 的数据来搞砸它。 (它可能仍然是一个链接器错误,但这不太可能。)

发生此错误通常是因为某些人不像像链接器那样敏锐,已经将超过 64K 字节放入链接器甚至有机会尝试之前的 SDA 部分。如果您做了类似的事情(可能拆分为多个文件;事实上,我认为如果您尝试在单个文件中创建超过 64K 的 SDA,我认为您将获得编译器或汇编器诊断),那么最不知情的人可能

#pragma startsda
int small_data[10000];  // 40Kbytes
int small_data_also[10000];  // another 40Kbytes
#pragma endsda

就是您。

但是,如果您传递诸如 -sda=4 之类的选项(其作用就好像您在每个全局变量周围抛出一个 #pragmastartsda ),那么不知情的人也可能是编译器。整个文件中 4 个字节或更小的变量),并且您有大量的全局变量。编译器会很乐意在 20 个单独的文件中的每个文件中 SDAize 10,000 字节,然后链接器会抱怨您正在向它传递 200,000 字节的 SDA。 (链接器足够聪明,可以将常规数据引用重写为 SDA 引用,但从未被教导如何以相反的方向重写内容。)

最后,即使您认为,您也没有传递 -sda=,你可能会感到惊讶。使用 -#-v 选项运行驱动程序。 IIRC,ccintppc 默认秘密传递 -sda=4。你可以让司机停止“帮助”你;只需传递 -sda=none-sda=0,这应该覆盖驱动程序的默认值。您可能希望逐个文件传递此选项,从您的 最冷的代码

This linker error is usually not related to the -Olink optimization -auto_sda. The linker sees your whole program and will try not to screw it up by autoSDAizing more than 64K of your data. (It might still be a linker bug, but that's unlikely.)

This error usually happens because someone who is not as perceptive as the linker has already put more than 64K bytes into SDA sections before the linker even gets a chance to have a go at it. The unperceptive individual might be you, if you did something like

#pragma startsda
int small_data[10000];  // 40Kbytes
int small_data_also[10000];  // another 40Kbytes
#pragma endsda

(possibly split across multiple files; in fact I think you'll get a compiler or assembler diagnostic if you try to create more than 64K of SDA in a single file).

But the unperceptive individual might also be the compiler, if you're passing options such as -sda=4 (which acts as if you threw a #pragma startsda around every global variable of 4 bytes or smaller in the entire file) and you have a ton of global variables. The compiler will happily SDAize 10,000 bytes in each of 20 individual files, and then the linker will complain that you're handing it 200,000 bytes of SDA. (The linker is smart enough to rewrite regular data references into SDA references, but has never been taught how to rewrite things in the opposite direction.)

Finally, even if you think you're not passing -sda=, you might be surprised. Run the driver with the -# or -v option. IIRC, ccintppc secretly passes -sda=4 by default. You can get the driver to stop "helping" you; just pass -sda=none or -sda=0, which should override the driver's default. You might want to pass this option on a file-by-file basis, starting with your coldest code.

我三岁 2024-09-07 20:47:11

经过一些研究后,所有不使用 SDA 选项的链接库可能会出现此冲突。由于我无法控制这些库的构建方式,目前我已将以下标志应用于我的 GPJ,这似乎解决了该问题:

-Onolink
-no_auto_sda
-nothreshold

请注意,这些选项禁用所有链接器优化并完全禁用 SDA 选项。

After doing some research, it's possible that linking libraries that all don't use the SDA option might have this conflict. Since I don't have control over how those libraries are built, at the moment I've applied the following flags to my GPJ that seemed to resolve the issue:

-Onolink
-no_auto_sda
-nothreshold

Note that these options disable all linker optimizations and disable the SDA option completely.

南渊 2024-09-07 20:47:11

我遇到了同样的问题,这也应该可以为您解决:

编译器选项 -large_sda 将允许 23 位 SDA 重定位而不是 16 位。那么您还应该能够毫无问题地使用 -sda=all

I had the same issue, this should fix it for you too:

The compiler option -large_sda will allow 23-bit SDA relocations instead of 16bits. Then you should also be able to use -sda=all without problems.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文