From 6307a01b6fc364dd2c24fd8854e754a9ce0c7fac Mon Sep 17 00:00:00 2001 From: Christoph Urlacher Date: Thu, 5 Feb 2026 17:55:22 +0100 Subject: [PATCH] disable -O2 --- examples/arch/bochs.mk | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/examples/arch/bochs.mk b/examples/arch/bochs.mk index 34c837a..f905708 100644 --- a/examples/arch/bochs.mk +++ b/examples/arch/bochs.mk @@ -4,7 +4,7 @@ WASI_CC := ${WASI_ROOT}/bin/clang WASI_CFLAGS := --target=wasm32 \ --sysroot=${WASI_ROOT}/share/wasi-sysroot \ -z stack-size=4096 \ - -O2 -nostdlib \ + -O0 -nostdlib \ -Wl,--no-entry \ -Wl,--initial-memory=65536 \ -Wl,--export-all \ @@ -15,17 +15,15 @@ WASI_CFLAGS := --target=wasm32 \ WAMR := /opt/wamr IWASM_LIB := /opt/wamr-libiwasm CC := gcc -# NOTE: Without -fomit-frame-pointer I get "error: bp cannot be used in ‘asm’ here" -CFLAGS := -I. -O2 -m32 -ffunction-sections -fomit-frame-pointer -LDFLAGS := -Wl,-T linker.ld $^ -Wl,--build-id=none -static -nostdlib -m32 \ - -Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm +# NOTE: When compiling I get "error: bp cannot be used in ‘asm’ here" +# I could remove "ebp" from the clobber list (ARCH_ASM_CLOBBER_ALL) or +# use the -fomit-frame-pointer flag to tell gcc it shouldn't rely on ebp for enter/leave... +CFLAGS := -I. -O0 -m32 -ffunction-sections -std=c11 -fomit-frame-pointer +LDFLAGS = -Wl,-T linker.ld $^ -Wl,--build-id=none -static -nostdlib -m32 \ + -Wl,-rpath,${IWASM_LIB} -L${IWASM_LIB} -liwasm -lgcc INCL := -I${WAMR}/core/iwasm/include \ - -I${WAMR}/core/iwasm/common \ - -I${WAMR}/core/shared/platform/include \ - -I${WAMR}/core/shared/platform/linux \ - -I${WAMR}/core/shared/mem-alloc \ - -I${WAMR}/core/shared/utils \ - -I${WAMR}/core/shared/utils/uncommon + -I${WAMR}/core/shared/utils \ + -I${WAMR}/core/shared/platform/baremetal WAMRC := /opt/wamr-wamrc/wamrc WAMRCFLAGS := --target=i386 --format=object XXD := busybox xxd @@ -87,11 +85,12 @@ BOCHS_RUNNER_ARGS = \ -V arch/bochs/vgabios.bin \ -b arch/bochs/BIOS-bochs-latest \ -${BUILD_DIR}/%/trace.pb: ${BUILD_DIR}/%/system.iso +# ${BUILD_DIR}/%/trace.pb: ${BUILD_DIR}/%/system.iso +${BUILD_DIR}/%/trace.pb: ${BOCHS_RUNNER} ${BOCHS_RUNNER_ARGS} -1 \ -f ${FAIL_TRACE} \ - -e $(shell dirname $<)/system.elf \ - -i $(shell dirname $<)/system.iso \ + -e $(shell dirname $<)/$*/system.elf \ + -i $(shell dirname $<)/$*/system.iso \ -- \ -Wf,--state-file=$(shell dirname $<)/state \ -Wf,--trace-file=$(shell dirname $<)/trace.pb \