[英]What is .zero in GNU gas?
In the following compiler output:在以下编译器 output 中:
a:
.long 4
b:
.byte 99
x:
.zero 4
c:
.byte 12
f:
.zero 4
What does the .zero
directive mean? .zero
指令是什么意思? It seems to be the only one not listed in the gas directives
.它似乎是唯一没有在
gas directives
中列出的。 Just from looking at the above, long
is four bytes, .byte
is one byte, and I'm guessing .zero
means zero-for-four-bytes (or whatever the number is after the directive).从上面看,
long
是四个字节, .byte
是一个字节,我猜.zero
表示四字节为零(或指令后面的任何数字)。 Is that correct?那是对的吗?
If so, why not just do .long 0
.如果是这样,为什么不直接做
.long 0
。 Does this put it in a different section or something?这是否将其放在不同的部分或其他地方?
No, it doesn't put it in a different section, it just puts it inline in whatever section you're currently creating.不,它不会将它放在不同的部分,它只是将它内联到您当前正在创建的任何部分中。
In terms of its relationship to .long
, the latter actually depends on the architecture.就其与
.long
的关系而言,后者实际上取决于架构。 It could be a different size and/or endianness.它可能是不同的大小和/或字节序。 Note the endianness probably won't matter for the zero value but the size may.
请注意,字节序可能对零值无关紧要,但大小可能。
The .zero
directive, on the other hand, is an alias for .skip
(and .space
on some architectures), and generates the requested number of bytes regardless of architecture.另一方面,
.zero
指令是.skip
(在某些架构上为.space
)的别名,并且无论架构如何都会生成请求的字节数。
Also keep in mind that, as an alias of .skip
, you can also provide the value you want used for the bytes (it defaults to zero) but it makes little sense to do something like:另请记住,作为
.skip
的别名,您还可以提供要用于字节的值(默认为零),但执行以下操作几乎没有意义:
.zero 4, 32
to generate four spaces:-)生成四个空格:-)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.