From 32538d33a5ec49f1c112564963ad9eae864aacb1 Mon Sep 17 00:00:00 2001 From: Yaossg Date: Mon, 18 Nov 2024 17:30:20 +0800 Subject: [PATCH] real machine script --- boot-native.sh | 12 ++++++++++++ run-native.sh | 6 ++++++ 2 files changed, 18 insertions(+) create mode 100644 boot-native.sh create mode 100644 run-native.sh diff --git a/boot-native.sh b/boot-native.sh new file mode 100644 index 0000000..3fe3375 --- /dev/null +++ b/boot-native.sh @@ -0,0 +1,12 @@ +mkdir -p build && cd build && +cat ../boot-lib.h ../boot.c | sed '/^#/d' > boot-all.c && +gcc ../boot.c ../boot-lib.c -o gcc.out && +./gcc.out < boot-all.c > boot1.s && +gcc -static boot1.s ../boot-lib.c -o boot1.out && +./boot1.out < boot-all.c > boot2.s && +gcc -static boot2.s ../boot-lib.c -o boot2.out && +./boot2.out < boot-all.c > boot3.s && +cmp --silent boot1.s boot2.s && echo "boot1.s == boot2.s" || echo "boot1.s != boot2.s" +cmp --silent boot2.s boot3.s && echo "boot2.s == boot3.s" || echo "boot2.s != boot3.s" +cmp --silent boot1.s boot3.s && echo "boot1.s == boot3.s" || echo "boot1.s != boot3.s" +rm boot-all.c \ No newline at end of file diff --git a/run-native.sh b/run-native.sh new file mode 100644 index 0000000..1403ddf --- /dev/null +++ b/run-native.sh @@ -0,0 +1,6 @@ +user@starfive:~/RVBTCC$ cat run.sh +gcc boot.c boot-lib.c && +./a.out < $1 > $1.s && +gcc -static $1.s boot-lib.c -o $1.out && +./$1.out +echo $? \ No newline at end of file