Files

36 lines
1.2 KiB
Bash
Executable File

#!/usr/bin/env sh
set -eu
nm=${RISCV_NM:-riscv64-unknown-elf-nm}
readelf=${RISCV_READELF:-riscv64-unknown-elf-readelf}
elf=build/task01_task_wrapper/prog.elf
if "$nm" -C -u "$elf" | grep -Eq '__cxa_|_Unwind_|std::|libstdc\+\+'; then
echo "unexpected 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 "unexpected virtual dispatch or RTTI" >&2
exit 1
fi
if "$readelf" -S "$elf" | grep -Eq \
'\.init_array|\.eh_frame|\.gcc_except_table'; then
echo "unexpected initializer, exception, or unwind section" >&2
exit 1
fi
if ! "$nm" -C --defined-only "$elf" | grep -Fq \
'freertos::Task<(anonymous namespace)::CounterTask>::trampoline(void*)'; then
echo "static typed trampoline is missing" >&2
exit 1
fi
for symbol in explicit_task_debug_checkpoint g_trampoline_context \
g_handle_after_start g_stack_low g_stack_high
do
if ! "$nm" --defined-only "$elf" | grep -Fq "$symbol"; then
echo "missing lifecycle evidence symbol: $symbol" >&2
exit 1
fi
done
echo "PASS ABI: static trampoline; no vtable, RTTI or hosted runtime"