cleanup
This commit is contained in:
10
build.sh
10
build.sh
@@ -3,14 +3,10 @@ mkdir -p out
|
|||||||
|
|
||||||
dotnet run --project lang/Nub.Lang example out/out.qbe
|
dotnet run --project lang/Nub.Lang example out/out.qbe
|
||||||
|
|
||||||
gcc -c -g -fno-stack-protector -fno-builtin std/baseline/gc.c -o out/gc.o
|
gcc -c -g -fno-stack-protector -fno-builtin std/gc.c -o out/gc.o
|
||||||
nasm -g -felf64 std/baseline/str_cmp.asm -o out/str_cmp.o
|
nasm -g -felf64 std/runtime.asm -o out/runtime.o
|
||||||
nasm -g -felf64 std/baseline/runtime.asm -o out/runtime.o
|
|
||||||
|
|
||||||
nasm -g -felf64 std/core/str_len.asm -o out/str_len.o
|
|
||||||
nasm -g -felf64 std/core/itoa.asm -o out/itoa.o
|
|
||||||
|
|
||||||
qbe out/out.qbe > out/out.s
|
qbe out/out.qbe > out/out.s
|
||||||
gcc -c -g out/out.s -o out/out.o
|
gcc -c -g out/out.s -o out/out.o
|
||||||
|
|
||||||
gcc -no-pie -nostartfiles -o out/program out/gc.o out/str_cmp.o out/str_len.o out/itoa.o out/runtime.o out/out.o
|
gcc -no-pie -nostartfiles -o out/program out/gc.o out/runtime.o out/out.o
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
extern func str_len(msg: string): int64;
|
|
||||||
extern func itoa(value: int64): string;
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import "core";
|
import "c";
|
||||||
|
|
||||||
global func main() {
|
global func main() {
|
||||||
let x = "test";
|
let x = "test";
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
global _start
|
|
||||||
extern main, gc_init
|
|
||||||
|
|
||||||
section .text
|
|
||||||
_start:
|
|
||||||
call gc_init
|
|
||||||
call main
|
|
||||||
mov rax, 60
|
|
||||||
mov rdi, 0
|
|
||||||
syscall
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
section .bss
|
|
||||||
buffer resb 20
|
|
||||||
|
|
||||||
section .text
|
|
||||||
global itoa
|
|
||||||
|
|
||||||
itoa:
|
|
||||||
mov rax, rdi
|
|
||||||
mov rsi, buffer + 19
|
|
||||||
mov byte [rsi], 0
|
|
||||||
dec rsi
|
|
||||||
.loop:
|
|
||||||
xor rdx, rdx
|
|
||||||
mov rcx, 10
|
|
||||||
div rcx
|
|
||||||
add dl, '0'
|
|
||||||
mov [rsi], dl
|
|
||||||
dec rsi
|
|
||||||
test rax, rax
|
|
||||||
jnz .loop
|
|
||||||
inc rsi
|
|
||||||
mov rax, rsi
|
|
||||||
ret
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
global str_len
|
|
||||||
|
|
||||||
section .text
|
|
||||||
str_len:
|
|
||||||
xor rax, rax
|
|
||||||
.loop:
|
|
||||||
cmp byte [rdi], 0
|
|
||||||
jz .done
|
|
||||||
inc rax
|
|
||||||
inc rdi
|
|
||||||
jmp .loop
|
|
||||||
.done:
|
|
||||||
ret
|
|
||||||
@@ -1,7 +1,18 @@
|
|||||||
global str_cmp
|
global _start
|
||||||
|
extern main, gc_init
|
||||||
|
|
||||||
section .text
|
section .text
|
||||||
str_cmp:
|
_start:
|
||||||
|
call gc_init
|
||||||
|
call main
|
||||||
|
mov rax, 60
|
||||||
|
mov rdi, 0
|
||||||
|
syscall
|
||||||
|
|
||||||
|
global base_str_cmp
|
||||||
|
|
||||||
|
section .text
|
||||||
|
base_str_cmp:
|
||||||
xor rdx, rdx
|
xor rdx, rdx
|
||||||
.loop:
|
.loop:
|
||||||
mov al, [rsi + rdx]
|
mov al, [rsi + rdx]
|
||||||
Reference in New Issue
Block a user