Skip to content

Commit

Permalink
Tested assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
Robert-M-Lucas committed Jun 3, 2024
1 parent 72e6d96 commit 84b46a2
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
Binary file added build/a.out
Binary file not shown.
4 changes: 4 additions & 0 deletions build/run.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
nasm -f elf64 ./test.asm
gcc ./test.o
./a.out
echo $?
11 changes: 11 additions & 0 deletions build/test.asm
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
global main

section .text

main:
push rbp
mov rbp, rsp
sub rsp, 0
mov eax, 12
leave
ret
Binary file added build/test.o
Binary file not shown.
2 changes: 1 addition & 1 deletion src/root/compiler/compile_function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ pub fn compile_function(fid: FunctionID, function: FunctionToken, global_table:
"{}:
push rbp
mov rbp, rsp
sub rsp, {},
sub rsp, {}
{}",
get_function_tag(fid),
if fid.is_main() { align_16_bytes(stack_size) } else { align_16_bytes_plus_8(stack_size) },
Expand Down

0 comments on commit 84b46a2

Please sign in to comment.