update wasm aot recipe for linux (only use --xip for fail/baremetal)

This commit is contained in:
2026-04-21 00:39:00 +02:00
parent 19048ed4bf
commit 0dbcaf68cd
2 changed files with 28 additions and 4 deletions

View File

@ -170,7 +170,7 @@ build module="__help" target="fail" mode="aot":
if [ "{{ mode }}" = "aot" ]; then if [ "{{ mode }}" = "aot" ]; then
just build-wasm-module {{ module }} just build-wasm-module {{ module }}
just build-wasm-aot {{ module }} just build-wasm-aot {{ module }} {{ target }}
just build-wasm-aot-array {{ module }} just build-wasm-aot-array {{ module }}
just prepare-aot-host {{ module }} just prepare-aot-host {{ module }}

View File

@ -49,13 +49,18 @@ LINUX_LDFLAGS_NOWASM := "\
-lm \ -lm \
" "
WAMRC := "wamrc" WAMRC := "wamrc"
WAMRCFLAGS := "\ CROSS_WAMRCFLAGS := "\
--target=i386 \ --target=i386 \
--cpu=generic \ --cpu=generic \
--opt-level=0 \ --opt-level=0 \
--enable-indirect-mode \ --enable-indirect-mode \
--disable-llvm-intrinsics \ --disable-llvm-intrinsics \
" "
LINUX_WAMRCFLAGS := "\
--target=i386 \
--cpu=generic \
--opt-level=0 \
"
XXD := "xxd" XXD := "xxd"
[doc("C -> WASM: Compile a C function to a WASM module using WASI-SDK")] [doc("C -> WASM: Compile a C function to a WASM module using WASI-SDK")]
@ -63,10 +68,29 @@ XXD := "xxd"
build-wasm-module module: build-wasm-module module:
{{ WASI_CC }} {{ WASI_CFLAGS }} targets/wasm-module/{{ module }}.cpp -o {{ BUILD_DIR }}-{{ module }}/wasm_module.wasm {{ WASI_CC }} {{ WASI_CFLAGS }} targets/wasm-module/{{ module }}.cpp -o {{ BUILD_DIR }}-{{ module }}/wasm_module.wasm
[private]
build-wasm-aot-linux module:
{{ WAMRC }} {{ LINUX_WAMRCFLAGS }} -o {{ BUILD_DIR }}-{{ module }}/wasm_module.aot {{ BUILD_DIR }}-{{ module }}/wasm_module.wasm
[private]
build-wasm-aot-cross module:
{{ WAMRC }} {{ CROSS_WAMRCFLAGS }} -o {{ BUILD_DIR }}-{{ module }}/wasm_module.aot {{ BUILD_DIR }}-{{ module }}/wasm_module.wasm
[doc("WASM -> AOT: Compile a WASM module ahead-of-time using WAMR")] [doc("WASM -> AOT: Compile a WASM module ahead-of-time using WAMR")]
[group("1: build module")] [group("1: build module")]
build-wasm-aot module: build-wasm-aot module target="fail":
{{ WAMRC }} {{ WAMRCFLAGS }} -o {{ BUILD_DIR }}-{{ module }}/wasm_module.aot {{ BUILD_DIR }}-{{ module }}/wasm_module.wasm #!/usr/bin/env sh
if [ "{{ target }}" = "fail" ]; then
just build-wasm-aot-cross "{{ module }}"
elif [ "{{ target }}" = "linux" ]; then
just build-wasm-aot-linux "{{ module }}"
elif [ "{{ target }}" = "linux-baremetal" ]; then
just build-wasm-aot-cross "{{ module }}"
else
echo "unknown target: {{ target }}" >&2
exit 1
fi
[doc("AOT -> C-Array: Dump a WASM module compiled ahead-of-time to a binary array")] [doc("AOT -> C-Array: Dump a WASM module compiled ahead-of-time to a binary array")]
[group("1: build module")] [group("1: build module")]