summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlejandro Sior <aho@sior.be>2022-07-30 22:53:58 +0200
committerAlejandro Sior <aho@sior.be>2022-07-30 22:53:58 +0200
commitab4e773dacc5411b7ede04950b07209dc606ad2f (patch)
tree6032329627c28565381c10cc47de146fc2c03b77 /test
cook: add basic makefile generation
Diffstat (limited to 'test')
-rw-r--r--test/.build5
-rw-r--r--test/main.c8
-rw-r--r--test/test.asm6
3 files changed, 19 insertions, 0 deletions
diff --git a/test/.build b/test/.build
new file mode 100644
index 0000000..8fdda48
--- /dev/null
+++ b/test/.build
@@ -0,0 +1,5 @@
+linker_sc = CWD / "linker.sc"
+
+as_obj = asm("test.asm")
+obj = cc("main.c", extra_args="-T" + str(linker_sc))
+aout = ld("a.out", obj, as_obj) \ No newline at end of file
diff --git a/test/main.c b/test/main.c
new file mode 100644
index 0000000..ce0991a
--- /dev/null
+++ b/test/main.c
@@ -0,0 +1,8 @@
+#include <stdio.h>
+
+int test();
+
+int main() {
+ printf("test returned: %d\n", test());
+ return 0;
+} \ No newline at end of file
diff --git a/test/test.asm b/test/test.asm
new file mode 100644
index 0000000..bcd7d20
--- /dev/null
+++ b/test/test.asm
@@ -0,0 +1,6 @@
+[bits 64]
+
+global test
+test:
+ mov eax, 69
+ ret \ No newline at end of file