23 lines
1.5 KiB
Bash
Executable File
23 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env sh
|
|
set -eu
|
|
nm=${RISCV_NM:-riscv64-unknown-elf-nm}
|
|
readelf=${RISCV_READELF:-riscv64-unknown-elf-readelf}
|
|
objdump=${RISCV_OBJDUMP:-riscv64-unknown-elf-objdump}
|
|
elf=build/task01_kernel_facade/prog.elf
|
|
if "$nm" -C -u "$elf" | grep -Eq '__cxa_|_Unwind_|std::|libstdc\+\+'; then echo "hosted C++ runtime dependency" >&2; exit 1; fi
|
|
if "$nm" -C --defined-only "$elf" | grep -Eq 'vtable for|typeinfo for|typeinfo name for'; then echo "virtual/RTTI metadata" >&2; exit 1; fi
|
|
if "$readelf" -S "$elf" | grep -Eq '\.init_array|\.eh_frame|\.gcc_except_table'; then echo "initializer/exception/unwind section" >&2; exit 1; fi
|
|
for symbol in kernel_facade_debug_checkpoint g_raw_critical_depth g_guard_scheduler_after_state g_kernel_facade_pass; do
|
|
if ! "$nm" --defined-only "$elf" | grep -Fq "$symbol"; then echo "missing evidence: $symbol" >&2; exit 1; fi
|
|
done
|
|
if "$nm" -C --defined-only "$elf" | grep -Eq 'freertos::(Scheduler|CriticalSection|SchedulerSuspendGuard)|freertos::this_task::'; then
|
|
echo "facade/guard emitted out-of-line symbols" >&2; exit 1
|
|
fi
|
|
if ! "$objdump" -d "$elf" | grep -Eq 'csrci[[:space:]]+mstatus|csrc[[:space:]]+mstatus|csrrc.*mstatus'; then
|
|
echo "missing critical-section interrupt-disable instruction" >&2; exit 1
|
|
fi
|
|
if ! "$objdump" -d "$elf" | grep -Eq 'csrsi[[:space:]]+mstatus|csrs[[:space:]]+mstatus|csrrs.*mstatus'; then
|
|
echo "missing critical-section interrupt-enable instruction" >&2; exit 1
|
|
fi
|
|
echo "PASS ABI: facade/guards inline; no vtable/runtime; mstatus transitions present"
|