2424 OPT_FLAGS=" -O3"
2525fi
2626
27+ # Set AOT debug flags if gdb feature is enabled
28+ if [[ " $FEATURES " == * " gdb" * ]]; then
29+ AOT_DEBUG_FLAGS=" --debug"
30+ else
31+ AOT_DEBUG_FLAGS=" "
32+ fi
33+
2734if [ -f " /.dockerenv" ] || grep -q docker /proc/1/cgroup; then
2835 # running in a container so use the installed wasi-sdk as the devcontainer has this installed
2936 for FILENAME in $( find . -name ' *.c' -not -path ' ./components/*' )
@@ -32,7 +39,7 @@ if [ -f "/.dockerenv" ] || grep -q docker /proc/1/cgroup; then
3239 # Build the wasm file with wasi-libc for wasmtime
3340 /opt/wasi-sdk/bin/clang ${DEBUG_FLAGS} -flto -ffunction-sections -mexec-model=reactor ${OPT_FLAGS} -z stack-size=4096 -Wl,--initial-memory=65536 -Wl,--export=__data_end -Wl,--export=__heap_base,--export=malloc,--export=free,--export=__wasm_call_ctors ${STRIP_FLAGS} -Wl,--no-entry -Wl,--allow-undefined -Wl,--gc-sections -o ${OUTPUT_DIR} /${FILENAME% .* } -wasi-libc.wasm ${FILENAME}
3441
35- cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${OUTPUT_DIR} /${FILENAME% .* } -wasi-libc.wasm ${OUTPUT_DIR} /${FILENAME% .* } .aot
42+ cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${AOT_DEBUG_FLAGS} ${ OUTPUT_DIR} /${FILENAME% .* } -wasi-libc.wasm ${OUTPUT_DIR} /${FILENAME% .* } .aot
3643 done
3744
3845 for WIT_FILE in ${PWD} /components/* .wit; do
@@ -53,7 +60,7 @@ if [ -f "/.dockerenv" ] || grep -q docker /proc/1/cgroup; then
5360 ${PWD} /components/bindings/${COMPONENT_NAME} _component_type.o
5461
5562 # Build AOT for Wasmtime
56- cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile --component ${OUTPUT_DIR} /${COMPONENT_NAME} -p2.wasm ${OUTPUT_DIR} /${COMPONENT_NAME} .aot
63+ cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${AOT_DEBUG_FLAGS} --component ${OUTPUT_DIR} /${COMPONENT_NAME} -p2.wasm ${OUTPUT_DIR} /${COMPONENT_NAME} .aot
5764 done
5865
5966else
8289 -v " ${OUTPUT_DIR_REAL} :${OUTPUT_DIR_REAL} " \
8390 wasm-clang-builder:latest /bin/bash -c " /opt/wasi-sdk/bin/clang ${DEBUG_FLAGS} -flto -ffunction-sections -mexec-model=reactor ${OPT_FLAGS} -z stack-size=4096 -Wl,--initial-memory=65536 -Wl,--export=__data_end -Wl,--export=__heap_base,--export=malloc,--export=free,--export=__wasm_call_ctors ${STRIP_FLAGS} -Wl,--no-entry -Wl,--allow-undefined -Wl,--gc-sections -o ${ABS_OUTPUT} ${ABS_INPUT} "
8491
85- cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${OUTPUT_WASM} ${OUTPUT_DIR} /${FILENAME% .* } .aot
92+ cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${AOT_DEBUG_FLAGS} ${ OUTPUT_WASM} ${OUTPUT_DIR} /${FILENAME% .* } .aot
8693 done
8794
8895 echo Building components
122129 ${ABS_BINDINGS_TYPE_O} "
123130
124131 # Build AOT for Wasmtime
125- cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile --component ${OUTPUT_WASM} ${OUTPUT_DIR} /${COMPONENT_NAME} .aot
132+ cargo run ${AOT_FEATURES} -p hyperlight-wasm-aot compile ${AOT_DEBUG_FLAGS} --component ${OUTPUT_WASM} ${OUTPUT_DIR} /${COMPONENT_NAME} .aot
126133 done
127134fi
128135
0 commit comments