real machine script

This commit is contained in:
Yaossg 2024-11-18 17:30:20 +08:00
parent b206dee0a9
commit 32538d33a5
2 changed files with 18 additions and 0 deletions

12
boot-native.sh Normal file
View File

@ -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

6
run-native.sh Normal file
View File

@ -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 $?