我想知道是否有类似C语言的解释器.也就是说,在Linux终端中我可以输入"python"然后在该解释器中编码.(我不确定翻译正确的词).这对于测试不同的东西真的很有帮助,我很好奇C是否存在类似的东西.虽然我对此表示怀疑.我能想到的唯一能做的就是C shell ......
按照这个说明,我设法只产生528字节的大小a.out(当gcc main.c最初给我8539字节的大文件时).
main.c是:
int main(int argc, char** argv) {
return 42;
}
Run Code Online (Sandbox Code Playgroud)
但我已经从这个汇编文件中构建了一个a.out:
电源:
; tiny.asm
BITS 64
GLOBAL _start
SECTION .text
_start:
mov eax, 1
mov ebx, 42
int 0x80
Run Code Online (Sandbox Code Playgroud)
有:
me@comp# nasm -f elf64 tiny.s
me@comp# gcc -Wall -s -nostartfiles -nostdlib tiny.o
me@comp# ./a.out ; echo $?
42
me@comp# wc -c a.out
528 a.out
Run Code Online (Sandbox Code Playgroud)
因为我需要机器码:
objdump -d a.out
a.out: file format elf64-x86-64
Disassembly of section .text:
00000000004000e0 <.text>:
4000e0: b8 01 00 00 00 mov $0x1,%eax …Run Code Online (Sandbox Code Playgroud)