use libelf to find code offset in the exe

This commit is contained in:
2026-02-28 16:36:42 +01:00
parent a92f02ed38
commit d06473b555
2 changed files with 88 additions and 2 deletions

View File

@@ -1,7 +1,7 @@
#!/bin/bash
set -euo pipefail
CFLAGS="-Wall -Wextra -Wpedantic -std=c99 -O3"
CFLAGS="-Wall -Wextra -Wpedantic -std=c99"
echo "building mos6502..."
cc $CFLAGS -o mos6502 mos6502.c
@@ -16,4 +16,16 @@ if command -v pkg-config >/dev/null; then
fi
else
echo "pkg-config not found - skipping chip8..."
fi
fi
if command -v pkg-config >/dev/null; then
LIBELF_FLAGS=$(pkg-config --cflags --libs libelf 2>/dev/null)
if [ $? -eq 0 ]; then
echo "building riscv64..."
cc $CFLAGS -o riscv64 riscv64.c $LIBELF_FLAGS
else
echo "raylib not found - skipping riscv64..."
fi
else
echo "pkg-config not found - skipping riscv64..."
fi