Trim compiled unit export surface

This commit is contained in:
udo
2026-07-18 10:11:06 +00:00
parent 69e8051fd3
commit eda124b15f
6 changed files with 107 additions and 11 deletions
+3 -2
View File
@@ -20,7 +20,7 @@ PCH_ENABLED=${UCE_WASM_UNIT_PCH:-1}
PCH_DIR=${UCE_WASM_PCH_DIR:-/tmp/uce/wasm-w2/pch}
COMMON_FLAGS=(
--target=wasm32-wasip1
-fPIC -fvisibility=default -fvisibility-inlines-hidden
-fPIC -fvisibility=hidden -fvisibility-inlines-hidden
-O1 -g -std=c++20
# The server captures this script's output and treats any non-empty result as
# a compile failure (then drops the .wasm), so a successful build must be
@@ -80,6 +80,7 @@ fi
-c "$DEST_DIR/$PP_FN" -o "$OBJ_FN"
"$SDK/bin/wasm-ld" -shared --experimental-pic \
--gc-sections \
--unresolved-symbols=import-dynamic \
--Bsymbolic \
"$OBJ_FN" -o "$WASM_TMP" \
@@ -92,7 +93,7 @@ fi
--export-if-defined=__uce_once \
--export-if-defined=__uce_init
"$SDK/bin/llvm-objcopy" --add-section=uce.abi="$ABI_TMP" "$WASM_TMP"
"$SDK/bin/llvm-objcopy" --strip-debug --add-section=uce.abi="$ABI_TMP" "$WASM_TMP"
python3 scripts/check_unit_wasm.py "$WASM_TMP" --abi-version "$ABI_VERSION" --llvm-nm "$SDK/bin/llvm-nm"
mv "$WASM_TMP" "$DEST_DIR/$WASM_FN"