From babb9985984740043045988827e55a69092ff044 Mon Sep 17 00:00:00 2001 From: Bretton Date: Wed, 6 Dec 2023 20:42:20 -0600 Subject: [PATCH] crux-mir translate_libs.sh: Add comments --- crux-mir/translate_libs.sh | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/crux-mir/translate_libs.sh b/crux-mir/translate_libs.sh index 72aeb2c83..1cebec7a4 100755 --- a/crux-mir/translate_libs.sh +++ b/crux-mir/translate_libs.sh @@ -2,13 +2,16 @@ set -e -: "${TARGET:=$(rustc -vV | sed -n 's/host: //p')}" +# If TARGET is not specified, scrape it from the 'host: ' line in +# rustc's output +: "${TARGET:=$(rustc --version --verbose | sed -n 's/host: //p')}" SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) RLIBS_PARENT="${SCRIPT_DIR}/rlibs_real" RLIBS_SYMLINK="${SCRIPT_DIR}/rlibs" RLIBS=$(rustc --target "$TARGET" --print target-libdir --sysroot "${RLIBS_PARENT}") +# Split target triple on '-' into arch, vendor, and os components IFS=- read -r TARGET_ARCH _TARGET_VENDOR TARGET_OS <<< "$TARGET" STD_ENV_ARCH=$TARGET_ARCH @@ -93,6 +96,8 @@ translate lib/hashbrown/src/lib.rs --edition=2021 --crate-name hashbrown --cfg ' echo 'Building addr2line...' translate lib/addr2line/src/lib.rs --crate-name addr2line --cfg 'feature="alloc"' --cfg 'feature="compiler_builtins"' --cfg 'feature="core"' --cfg 'feature="rustc-dep-of-std"' --extern "compiler_builtins=${RLIBS}/libcompiler_builtins.rlib" --extern "gimli=${RLIBS}/libgimli.rlib" --extern "alloc=${RLIBS}/liballoc.rlib" --extern "core=${RLIBS}/libcore.rlib" +# For wasm32 targets which are not emscripten, std depends on dlmalloc because +# the runtime does not provide an allocator. See libs/std/Cargo.toml. if [ "$TARGET_ARCH" = "wasm32" ] && [ "$TARGET_OS" != "emscripten" ]; then USE_DLMALLOC=yes echo 'Building dlmalloc...'