高效率推进 LinuxCNC 源码对齐流程

说明:集中 LinuxCNC 源码清单与 wasm/native probe 的路径解析,补强 manifest、shim、source-link 检查,并保持 LinuxCNC 源码后端对齐验证流程可复用。

验证:./test-native.sh;./test-linuxcnc-source-link.sh;./test-all-native.sh;wasm source/probe 相关脚本。
This commit is contained in:
cnc
2026-05-27 11:14:06 +08:00
parent ce2f3f3769
commit 40a63c76f7
44 changed files with 3566 additions and 475 deletions

View File

@@ -13,6 +13,14 @@ if [[ ! -d "$linuxcnc_root" ]]; then
fi
trap 'rm -rf "$build_dir"' EXIT
tooldata_mmap_backend_shim=$(./list-linuxcnc-wasm-safe-shims.sh tooldata_mmap_backend.cc)
tooldata_runtime_stubs_shim=$(./list-linuxcnc-wasm-safe-shims.sh tooldata_runtime_stubs.cc)
readarray -t linuxcnc_sources < <(LINUXCNC_ROOT="$linuxcnc_root" ./list-linuxcnc-source-files.sh \
src/emc/tooldata/tooldata_db.cc \
src/emc/tooldata/tooldata_nml.cc)
tooldata_db_source=${linuxcnc_sources[0]}
tooldata_nml_source=${linuxcnc_sources[1]}
common_flags=(
-std=c++17
-DULAPI
@@ -26,33 +34,49 @@ common_flags=(
)
"$cxx" "${common_flags[@]}" \
-c core/wasm_shims/tooldata/tooldata_runtime_stubs.cc \
-c "$tooldata_runtime_stubs_shim" \
-o "$build_dir/tooldata_runtime_stubs.o"
"$cxx" "${common_flags[@]}" \
-c "$tooldata_mmap_backend_shim" \
-o "$build_dir/tooldata_mmap_backend.o"
"$cxx" "${common_flags[@]}" \
-c "$tooldata_db_source" \
-o "$build_dir/linuxcnc_tooldata_db.o"
"$cxx" "${common_flags[@]}" \
-c "$tooldata_nml_source" \
-o "$build_dir/linuxcnc_tooldata_nml.o"
nm --defined-only "$build_dir/tooldata_runtime_stubs.o" \
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
| LC_ALL=C sort -u \
> "$build_dir/runtime.exports"
expected_exports=(
tool_nml_register
tooldata_db_getall
tooldata_db_init
tooldata_db_notify
)
nm --defined-only "$build_dir/tooldata_mmap_backend.o" \
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
| LC_ALL=C sort -u \
> "$build_dir/backend.exports"
printf '%s\n' "${expected_exports[@]}" | LC_ALL=C sort -u > "$build_dir/expected.exports"
nm --defined-only "$build_dir"/linuxcnc_tooldata_*.o \
| awk '$2 ~ /^[A-Z]$/ {print $3}' \
| LC_ALL=C sort -u \
> "$build_dir/linuxcnc-runtime.exports"
comm -23 "$build_dir/linuxcnc-runtime.exports" "$build_dir/backend.exports" \
> "$build_dir/expected.exports"
comm -23 "$build_dir/expected.exports" "$build_dir/runtime.exports" > "$build_dir/missing.exports"
if [[ -s "$build_dir/missing.exports" ]]; then
echo "missing wasm tooldata runtime stub exports:" >&2
echo "missing wasm tooldata runtime stub exports from LinuxCNC runtime sources:" >&2
cat "$build_dir/missing.exports" >&2
exit 1
fi
comm -13 "$build_dir/expected.exports" "$build_dir/runtime.exports" > "$build_dir/unexpected.exports"
if [[ -s "$build_dir/unexpected.exports" ]]; then
echo "unexpected wasm tooldata runtime stub exports:" >&2
echo "unexpected wasm tooldata runtime stub exports beyond LinuxCNC runtime sources:" >&2
cat "$build_dir/unexpected.exports" >&2
exit 1
fi