Skip to content

Commit 1dcc1ff

Browse files
Log how much size the executeLoop uses on the PS2 target when building, fail if it exceeds 16KB
1 parent d49a24a commit 1dcc1ff

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

.github/workflows/build.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,31 @@ jobs:
184184
cmake --build build -j$(nproc)
185185
cp build/butterscotch build/butterscotch.elf
186186
187+
- name: Check executeLoop I-Cache fit
188+
run: |
189+
# Extract executeLoop function size from the ELF symbol table
190+
# nm -S prints: address size type name
191+
echo "Getting executeLoop size from ELF symbol table..."
192+
SYMBOL_LINE=$(mips64r5900el-ps2-elf-nm -S build/butterscotch.elf | grep ' executeLoop$' || true)
193+
if [ -z "$SYMBOL_LINE" ]; then
194+
echo "::error::Could not find executeLoop symbol in ELF (is it stripped?)"
195+
exit 1
196+
fi
197+
# Size is the second hex field
198+
SIZE_HEX=$(echo "$SYMBOL_LINE" | awk '{print $2}')
199+
SIZE_DEC=$((16#$SIZE_HEX))
200+
LIMIT=16384
201+
if [ "$SIZE_DEC" -gt "$LIMIT" ]; then
202+
echo "::error::executeLoop is $SIZE_DEC bytes, exceeding the PS2 16 KB I-Cache ($LIMIT bytes) by $((SIZE_DEC - LIMIT)) bytes"
203+
echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY
204+
echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY
205+
echo "| \`executeLoop\` | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | **EXCEEDED** by $((SIZE_DEC - LIMIT)) bytes |" >> $GITHUB_STEP_SUMMARY
206+
exit 1
207+
fi
208+
echo "| Function | Size | Limit | Status |" >> $GITHUB_STEP_SUMMARY
209+
echo "|----------|------|-------|--------|" >> $GITHUB_STEP_SUMMARY
210+
echo "| \`executeLoop\` | $SIZE_DEC bytes | $LIMIT bytes (16 KB) | $((LIMIT - SIZE_DEC)) bytes remaining |" >> $GITHUB_STEP_SUMMARY
211+
187212
- name: Upload artifact
188213
uses: actions/upload-artifact@v4
189214
with:

0 commit comments

Comments
 (0)