ARM + GCC:不使用一个大.RODATA节 [英] ARM + gcc: don't use one big .rodata section

查看:1532
本文介绍了ARM + GCC:不使用一个大.RODATA节的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要编译一个程序与ARM处理器链接时优化GCC。当我编译没有LTO,该系统被编译。当我使LTO
(有-flto),我得到以下汇编程序错误:

I want to compile a program with gcc with link time optimization for an ARM processor. When I compile without LTO, the system gets compiled. When I enable LTO (with -flto), I get the following assembler-error:

错误:无效的常量:池必须接近

Error: invalid literal constant: pool needs to be closer

找我发现这个事做在我的常数,它被放置在一个特殊的部分称为.RODATA,这被称为常量池,并.text段的右后放在网络上我的系统。这似乎与内联,因为和其他优化LTO编译时,此.RODATA部分过于远离指令,从而使常量的寻址是不可能的了。是否有可能常量放置使用它们的功能后,对不对?或者是有可能使用另一种寻址模式所以.RODATA部分仍然可以处理?谢谢。

Looking around the web I found out that this has something to do with the constants in my system, which are placed in a special section called .rodata, which is called a constant pool and is placed right after the .text section in my system. It seems that when compiling with LTO because of inlining and other optimizations this .rodata section gets too far away from the instructions, so that the addressing of the constants is not possible anymore. Is it possible to place the constants right after the function that uses them? Or is it possible to use another addressing mode so the .rodata section can still be addressed? Thanks.

推荐答案

这是一个汇编的消息,而不是一个链接的消息,所以在这之前章节中生成的 - 我不知道,但我认为这是一个有点更多的并发LTO。编译单个C-文件,LTO(包括组装)运行工作正常,并不会造成任何问题。当我尝试将它们链接在一起启用LTO出现问题。我不知道怎么LTO究竟是做了,但显然这还包括再次调用汇编程序,然后我得到这个错误信息。当没有连接LTO,一切都很好,当我看着我disassemly可以看到我的常量不放在一个功能之后。代替所有常量被放置在.RODATA部分。启用LTO因为内联,我的功能可能会得到大的达到常量池中...

"This is an assembler message, not a linker message, so this happens before sections are generated" - I am not sure but I think it is a little bit more complicated with LTO. Compiling (including assembling) of the individual c-files with LTO enabled works fine and does not cause any problems. The problem occurs when I try to link them together with LTO enabled. I don't know how LTO is exactly done, but apparently this also includes calling the assembler again and then I get this error message. When linking without LTO, everything is fine and when I look at the disassemly I can see that my constants are not placed after a function. Instead all constants are placed in the .rodata section. With LTO enabled because of inlining, my functions probably get to large to reach the constant pool...

这篇关于ARM + GCC:不使用一个大.RODATA节的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆