История изменений
Исправление Kroz, (текущая версия) :
Пойдёт?
$ cat tiny.cpp
extern "C" void _start() {
__asm__ volatile (
"movl $1, %eax\n" // syscall: sys_exit
"xorl %ebx, %ebx\n" // status: 0
"int $0x80\n" // invoke syscall
);
}
$ g++ -nostdlib -static -Wl,--gc-sections -ffunction-sections -Os -o tiny tiny.cpp
$ ls -la tiny
-rwxr-xr-x 1 kroz kroz 9056 Feb 13 20:26 tiny
P. S.
$ cat tiny.asm
section .text
global _start
_start:
mov eax, 1 ; syscall: sys_exit
xor ebx, ebx ; status: 0
int 0x80 ; invoke syscall
$ nasm -f elf64 -o tiny.o tiny.asm
$ ld -n -o tiny tiny.o
$ strip --strip-all tiny
$ ls -la tiny
-rwxr-xr-x 1 kroz kroz 352 Feb 13 20:36 tiny
Исходная версия Kroz, :
Пойдёт?
$ cat tiny.cpp
extern "C" void _start() {
__asm__ volatile (
"movl $1, %eax\n" // syscall: sys_exit
"xorl %ebx, %ebx\n" // status: 0
"int $0x80\n" // invoke syscall
);
}
$ g++ -nostdlib -static -Wl,--gc-sections -ffunction-sections -Os -o tiny tiny.cpp
$ ls -la tiny
-rwxr-xr-x 1 kroz kroz 9056 Feb 13 20:26 tiny