update freestanding study

This commit is contained in:
2025-12-30 17:28:02 +09:00
parent 8f1a81b699
commit 33c5e8bfb6
4 changed files with 22 additions and 0 deletions
+2
View File
@@ -0,0 +1,2 @@
free
*.o
Executable
+3
View File
@@ -0,0 +1,3 @@
#!/bin/sh
g++ -m32 -c -o free.o free.cpp -ffreestanding && ld -m elf_i386 -o free free.o
+7
View File
@@ -0,0 +1,7 @@
extern "C" void _start() {
asm volatile (
"mov $1, %eax\n"
"mov $0, %ebx\n"
"int $0x80"
);
}
+10
View File
@@ -0,0 +1,10 @@
# freestanding
```bash
g++ -c -o free.o free.cpp
ld -o free free.o
objdump -x free
# g++ -c -nostdlib -o free free.cpp
```