DF-1297 / build.sh
#!/bin/sh # DF-1297 harness build. # -O0 is REQUIRED: at -O2 gcc sees integer div-by-zero as UB and elides the # `div` instruction. The real kernel builds at -O2 BUT the divisor is read # at runtime from a parsed VBIOS struct pointer (hwmgr->thermal_controller. # advanceFanControlParameters.usTMed), so gcc cannot see it is zero and emits # a real `div` -> #DE trap -> panic. -O0 faithfully reproduces that runtime # division in userspace. set -e cd "$(dirname "$0")" cc -O0 -Wall -o harness harness.c echo "BUILD_EXIT=$?" ls -l harness |