Skip to content

Commit

Permalink
crux-mir translate_libs.sh: Add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
qsctr committed Dec 7, 2023
1 parent 5116a34 commit babb998
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crux-mir/translate_libs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

set -e

: "${TARGET:=$(rustc -vV | sed -n 's/host: //p')}"
# If TARGET is not specified, scrape it from the 'host: <target_triple>' 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
Expand Down Expand Up @@ -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...'
Expand Down

0 comments on commit babb998

Please sign in to comment.