|
发表于 2022-11-26 17:06:16
|
显示全部楼层
从前的编译器不能立即数到内存
- sh-5.1$ cat main.s
- .text
- .global _start
- _start:
- movl $0, 0
- retl
- sh-5.1$ as --32 -o main.o main.s
- sh-5.1$ objdump -S -M suffix main.o
- main.o: file format elf32-i386
- Disassembly of section .text:
- 00000000 <_start>:
- 0: c7 05 00 00 00 00 00 movl $0x0,0x0
- 7: 00 00 00
- a: c3 retl
- sh-5.1$ vim main.s
- sh-5.1$ cat main.s
- .code16
- .text
- .global _start
- _start:
- movw $0, 0
- retw
- sh-5.1$ as --32 -o main.o main.s
- sh-5.1$ objdump -S -M suffix main.o
- main.o: file format elf32-i386
- Disassembly of section .text:
- 00000000 <_start>:
- 0: c7 06 00 00 00 00 movl $0x0,(%esi)
- 6: c3 retl
- sh-5.1$ objdump -S -M suffix -m i8086 main.o
- main.o: file format elf32-i386
- Disassembly of section .text:
- 00000000 <_start>:
- 0: c7 06 00 00 00 00 movw $0x0,0x0
- 6: c3 retw
- sh-5.1$
复制代码 |
|