RVBTCC/boot.sh

23 lines
718 B
Bash
Raw Permalink Normal View History

2024-12-24 13:31:12 +00:00
if [ $(uname -m) != "riscv64" ]; then
function compile_and_run() {
riscv64-linux-gnu-gcc-12 -static $1.s -o $1.elf &&
qemu-riscv64 $1.elf < ../boot.c > $2.s
return $?
}
else
function compile_and_run() {
gcc $1.s -o $1.elf &&
./$1.elf < ../boot.c > $2.s
return $?
}
fi
2024-11-15 13:39:51 +00:00
mkdir -p build && cd build &&
2024-12-23 14:42:31 +00:00
gcc ../boot.c -o gcc.elf &&
./gcc.elf < ../boot.c > boot1.s &&
2024-12-24 13:31:12 +00:00
compile_and_run boot1 boot2 &&
compile_and_run boot2 boot3
2024-11-15 13:38:01 +00:00
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"