GNU 汇编程序 x86 指令后缀如 "mov.s" 中的“.s”如何工作?
How do GNU assembler x86 instruction suffixes like ".s" in "mov.s" work?
GNU 汇编程序似乎有一些方法可以控制为某些指令发出的操作码的替代形式。例如
.intel_syntax noprefix
mov eax, ecx
mov.s eax, ecx
用 as test.s -o test.o && objdump -d test.o -M intel
处理上面的代码得到以下反汇编:
0: 89 c8 mov eax,ecx
2: 8b c1 mov eax,ecx
我们可以看到 .s
后缀出现将 89
操作码切换到 8b
版本(并适当更改 ModRM 字节)。
此语法在 GAS 中如何工作?我找不到任何相关文档。
从 Binutils 2.29 开始,指令后缀现在是 deprecated in favor of pseudo-prefixes. You can find the older suffixes documented in the GNU Assembler (pre-2.29) info pages. Earlier info as
页这样说:
9.15.4.1 Instruction Naming
[snip]
Different encoding options can be specified via optional mnemonic suffix. .s suffix swaps 2 register operands in encoding when moving from one register to another. .d8 or .d32 suffix prefers 8bit or 32bit displacement in encoding.
记录新的伪前缀,Binutils 2.29(及更高版本)info as
页面修改为:
Different encoding options can be specified via pseudo prefixes:
- {disp8} – prefer 8-bit displacement.
- {disp32} – prefer 32-bit displacement.
- {load} – prefer load-form instruction.
- {store} – prefer store-form instruction.
- {vex2} – prefer 2-byte VEX prefix for VEX instruction.
- {vex3} – prefer 3-byte VEX prefix for VEX instruction.
- {evex} – encode with EVEX prefix.
GNU 汇编程序似乎有一些方法可以控制为某些指令发出的操作码的替代形式。例如
.intel_syntax noprefix
mov eax, ecx
mov.s eax, ecx
用 as test.s -o test.o && objdump -d test.o -M intel
处理上面的代码得到以下反汇编:
0: 89 c8 mov eax,ecx
2: 8b c1 mov eax,ecx
我们可以看到 .s
后缀出现将 89
操作码切换到 8b
版本(并适当更改 ModRM 字节)。
此语法在 GAS 中如何工作?我找不到任何相关文档。
从 Binutils 2.29 开始,指令后缀现在是 deprecated in favor of pseudo-prefixes. You can find the older suffixes documented in the GNU Assembler (pre-2.29) info pages. Earlier info as
页这样说:
9.15.4.1 Instruction Naming
[snip]
Different encoding options can be specified via optional mnemonic suffix. .s suffix swaps 2 register operands in encoding when moving from one register to another. .d8 or .d32 suffix prefers 8bit or 32bit displacement in encoding.
记录新的伪前缀,Binutils 2.29(及更高版本)info as
页面修改为:
Different encoding options can be specified via pseudo prefixes:
- {disp8} – prefer 8-bit displacement.
- {disp32} – prefer 32-bit displacement.
- {load} – prefer load-form instruction.
- {store} – prefer store-form instruction.
- {vex2} – prefer 2-byte VEX prefix for VEX instruction.
- {vex3} – prefer 3-byte VEX prefix for VEX instruction.
- {evex} – encode with EVEX prefix.