From 26c68379d0834321b78bd35b6adef7b87f667df9 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 1 Jan 2024 10:48:14 +0100 Subject: [PATCH 1/2] fmt --- flap/runtime/runtime.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/flap/runtime/runtime.c b/flap/runtime/runtime.c index e428878..78d8654 100644 --- a/flap/runtime/runtime.c +++ b/flap/runtime/runtime.c @@ -36,6 +36,7 @@ int64_t write_block(intptr_t *block, int64_t n, intptr_t v) { return 0; } -void add_eight_int(int64_t x1,int64_t x2,int64_t x3,int64_t x4,int64_t x5, int64_t x6,int64_t x7,int64_t x8) { - return observe_int(x1+x2+x3+x4+x5+x6+x7+x8); +void add_eight_int(int64_t x1, int64_t x2, int64_t x3, int64_t x4, int64_t x5, + int64_t x6, int64_t x7, int64_t x8) { + return observe_int(x1 + x2 + x3 + x4 + x5 + x6 + x7 + x8); } From 1ee322b0649c5d12394ea6167301fce95ff48cc7 Mon Sep 17 00:00:00 2001 From: Mylloon Date: Mon, 1 Jan 2024 10:48:42 +0100 Subject: [PATCH 2/2] use custom runtime --- flap/questions/retrolixToX86_64/Makefile | 4 +++- flap/questions/retrolixToX86_64/runtime.c | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 flap/questions/retrolixToX86_64/runtime.c diff --git a/flap/questions/retrolixToX86_64/Makefile b/flap/questions/retrolixToX86_64/Makefile index f32401e..6cc28ff 100644 --- a/flap/questions/retrolixToX86_64/Makefile +++ b/flap/questions/retrolixToX86_64/Makefile @@ -18,7 +18,9 @@ interpret: build compilo: build @for f in $(wildcard *.$(TARGET)); do \ printf "%s: " $$f; \ - ./$(FLAP) -t elf $$f && \ + ./$(FLAP) -t x86-64 $$f && \ + gcc -no-pie -o $${f%.*}.elf $${f%.*}.s runtime.c && \ ./$${f%.*}.elf; \ + rm $${f%.*}.s; \ printf "\n"; \ done diff --git a/flap/questions/retrolixToX86_64/runtime.c b/flap/questions/retrolixToX86_64/runtime.c new file mode 100644 index 0000000..083c9af --- /dev/null +++ b/flap/questions/retrolixToX86_64/runtime.c @@ -0,0 +1,13 @@ +#include +#include + +int64_t add_eight_int(int64_t i1, int64_t i2, int64_t i3, int64_t i4, + int64_t i5, int64_t i6, int64_t i7, int64_t i8) { + return i1 + i2 + i3 + i4 + i5 + i6 + i7 + i8; +} + +int64_t observe_int(int64_t n) { + printf("%ld", n); + + return n; +}