一段时间以来,我一直在自学 GNU 汇编,用 C 语言编写语句,用“gcc -S”编译它们并研究输出。这在 x86(并使用 -m32 编译)上可以正常工作,但在我的 AMD64 机器上,对于此代码(仅作为示例):
int main()
{
return 0;
}
海湾合作委员会给了我:
.文件“test.c” 。文本 .globl 主要 .type 主要,@function 主要的: .LFB2: pushq %rbp .LCFI0: movq %rsp, %rbp .LCFI1: 移动 $0, %eax 离开 ret .LFE2: .size 主要,.-main .section .eh_frame,"a",@progbits .Lframe1: .long .LECIE1-.LSCIE1 .LSCIE1: .long 0x0 .byte 0x1 .string "zR" .uleb128 0x1 .sleb128 -8 .byte 0x10 .uleb128 0x1 .byte 0x3 .byte 0xc .uleb128 0x7 .uleb128 0x8 .byte 0x90 .uleb128 0x1 .align 8 .LECIE1: .LSFDE1: .long .LEFDE1-.LASFDE1 .LASFDE1: .long .LASFDE1-.Lframe1 .long .LFB2 .long .LFE2-.LFB2 .uleb128 0x0 .byte 0x4 .long .LCFI0-.LFB2 .byte 0xe .uleb128 0x10 .byte 0x86 .uleb128 0x2 .byte 0x4 .long .LCFI1-.LCFI0 .byte 0xd .uleb128 0x6 .align 8 .LEFDE1: .ident“GCC:(Ubuntu 4.3.3-5ubuntu4)4.3.3” .section .note.GNU-stack,"",@progbits
和....相比:
.文件“test.c” 。文本 .globl 主要 .type 主要,@function 主要的: leal 4(%esp), %ecx 和 $-16, %esp pushl -4(%ecx) 推%ebp movl %esp, %ebp 推%ecx 移动 $0, %eax 流行 %ecx 流行 %ebp leal -4(%ecx), %esp ret .size 主要,.-main .ident“GCC:(Ubuntu 4.3.3-5ubuntu4)4.3.3” .section .note.GNU-stack,"",@progbits
在 x86 上。
有没有办法在没有绒毛的情况下在 x86_64 输出程序集上制作 GCC -S?