mov %r8d,0
nop
- 执行命令:
gcc -c mov_.S
会输出 mov_.o 文件: objdump -D mov_.o
:
mov_.o: 文件格式 elf64-x86-64
Disassembly of section .text:
0000000000000000 <.text>:
0: 44 89 04 25 00 00 00 mov %r8d,0x0
7: 00
8: 90 nop
void main() {
}
- 执行命令:
gcc -S main.c
输出文件 main.s
main.s
:
.file "main.c"
.text
.globl main
.type main, @function
main:
.LFB0:
.cfi_startproc
pushq %rbp
.cfi_def_cfa_offset 16
.cfi_offset 6, -16
movq %rsp, %rbp
.cfi_def_cfa_register 6
nop
popq %rbp
.cfi_def_cfa 7, 8
ret
.cfi_endproc
.LFE0:
.size main, .-main
.ident "GCC: (Uos 8.3.0.3-3+rebuild) 8.3.0"
.section .note.GNU-stack,"",@progbits
section .text
global _start
_start:
; 将 0 存入 r8d 寄存器
mov r8d, 0
; 退出程序
mov eax, 1
xor ebx, ebx
int 0x80