在尝试编译我的项目时,该项目使用了一些第三方标头,在 mingw 4.4 中,我遇到了以下错误:
汇编消息:
错误:行尾有垃圾,第一个无法识别的字符是 '"'
错误:未知的伪操作:'.previous'
我在其中一个包含的标头的末尾找到了这段代码:
__asm__(".section \".plc\"");
__asm__(".previous");
由于我根本没有任何使用内联汇编指令的经验,因此我在谷歌上搜索了解释它,但找不到我的两个基本问题的答案。 __asm__(".previous");
实际上是做什么的,为什么有人会把它放在头文件的末尾。
这些是整个项目中唯一的 __asm__ 指令。我可以安全地删除它们吗?或者有没有办法定义 .previous 以便使其成为已知的伪操作?
请赐教!
While trying to compile my project, that uses some third party headers, with mingw 4.4, I encountered the following error:
Assembler messages:
Error: junk at end of line, first unrecognized character is '"'
Error: unknown pseudo-op: '.previous'
I found this code at the end of one of the included headers:
__asm__(".section \".plc\"");
__asm__(".previous");
Since I do not have any experience at all with in-line assembler instructions, I googled for an explanation to it, but couldn't find the answer to my two basic questions. What does __asm__(".previous");
acctually do and why would anyone put this at the end of a header file.
These are the only __asm__
instructions in the whole project. Can I safely delete them? Or is there a way to define .previous in order to make it a known pseudo-op?
Enlighten me, please!
发布评论
评论(1)
.previous
是一个指令,可让您在两个 elf 部分之间来回交换。它是一种快捷方式,允许更密集的汇编文件,并允许您在代码流中声明初始化数据,反之亦然。例如,假设您有一个包含数据和代码部分的汇编程序文件。
如果您想在函数中间在数据段中声明一个常量,您可以使用 .previous 语句,如下所示:
更多信息可以在参考手册中找到:
http://sourceware.org/binutils/docs-2.19/as/Previous.html#Previous
.previous
is a directive that lets you swap back and forth between two elf sections. It is a shortcut that allows denser assembly files and lets you for example declare initialized data within a stream of code or vice versa.For example say you have an assembler file with a data and a code section.
If you want - in the middle of a function - declare a constant in the data segment you can use the .previous statement like this:
More information can be found in the reference manual:
http://sourceware.org/binutils/docs-2.19/as/Previous.html#Previous