GNU Gas 程序集中等号赋值 "x = 1" 和“.equ x, 1”或“.set x, 1”之间有区别吗?
Is there a difference between equals sign assignment "x = 1" and ".equ x, 1" or ".set x, 1" in GNU Gas assembly?
例如:
a = 1
和:
.equ a, 1
和:
.set a, 1
全部在以下情况下逐字节产生相同的输出:
as --32 main.S
根据cmp
.
我知道 .equ
和 .set
根据 .equ
的文档做同样的事情: https://sourceware.org/binutils/docs-2.25/as/Equ.html :
It is synonymous with `.set'.
而且我从 Difference between .equ and .word in ARM Assembly?
知道 .equ
做了什么
那么 =
呢?和另外两个一样吗?
是一样的
搜索文档源后,我找到了确认它的部分 https://sourceware.org/binutils/docs-2.25/as/Setting-Symbols.html
A symbol can be given an arbitrary value by writing a symbol, followed by an equals sign `=', followed by an expression (see Expressions). This is equivalent to using the .set directive.
例如:
a = 1
和:
.equ a, 1
和:
.set a, 1
全部在以下情况下逐字节产生相同的输出:
as --32 main.S
根据cmp
.
我知道 .equ
和 .set
根据 .equ
的文档做同样的事情: https://sourceware.org/binutils/docs-2.25/as/Equ.html :
It is synonymous with `.set'.
而且我从 Difference between .equ and .word in ARM Assembly?
知道.equ
做了什么
那么 =
呢?和另外两个一样吗?
是一样的
搜索文档源后,我找到了确认它的部分 https://sourceware.org/binutils/docs-2.25/as/Setting-Symbols.html
A symbol can be given an arbitrary value by writing a symbol, followed by an equals sign `=', followed by an expression (see Expressions). This is equivalent to using the .set directive.