Files
T

27 lines
904 B
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_first_task/prog.elf
if "$nm" --defined-only "$elf" | awk '{print $3}' | grep -Eq '^_Z|^__cxa_|^_Unwind_'; then
echo "unexpected C++ or unwind symbol in the C teaching ELF" >&2
exit 1
fi
if "$readelf" -S "$elf" | grep -Eq '\.init_array|\.eh_frame|\.gcc_except_table'; then
echo "unexpected C++ initialization or unwind section in $elf" >&2
"$readelf" -S "$elf" >&2
exit 1
fi
for symbol in sum_task_entry supervisor_task_entry task01_debug_checkpoint task01_debug_checkpoint_committed xTaskCreate vTaskDelete; do
if ! "$nm" --defined-only "$elf" | grep -Eq "[[:space:]]${symbol}$"; then
echo "required C/FreeRTOS symbol is missing: $symbol" >&2
exit 1
fi
done
echo "PASS ABI: freestanding C11 task callback, no C++ runtime or mangled symbols"