diff --git a/scripts/cross/wrappers/armv7_rustc.sh b/scripts/cross/wrappers/armv7_rustc.sh deleted file mode 100755 index 2518ae0c03146..0000000000000 --- a/scripts/cross/wrappers/armv7_rustc.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -# This is a wrapper script around `rustc`, which passes custom arguments to rustc. -# -# Normally, custom rustc arguments would be configured by setting the `rustflags` key in -# `.cargo/config.toml`, but that key is overridden by the `RUSTFLAGS` env var, which is set *inside* -# the `cross` Docker container for AArch64, so we unfortunately need this custom rustc wrapper. -# -# To make matters worse, it is not possible to override `rustc` only for a specific target, so we -# have to make sure that we *only* pass the custom arguments when the compilation target is AArch64. -# -# Ideally, `rustflags` from `.cargo/config` and the `RUSTFLAGS` env var would be merged, which is -# tracked in this Cargo issue: https://github.com/rust-lang/cargo/issues/5376 - -set -e - -SELF=$(dirname "$0") - -LIBSTDCXX_PATH="/usr/local/arm-linux-musleabihf/lib" -LINKER="${SELF}/linker.sh" - -# We don't get passed the target in any env var, so we'd have to parse cli args and look for the -# `--target` flag :( -TARGET="" -ARGS=() -for ARG in "$@"; do - # FIXME: --target=bla is valid too, but we don't handle that - - if [[ "${TARGET}" == "next" ]]; then - TARGET="${ARG}" - fi - - if [[ "${ARG}" == "--target" ]]; then - TARGET="next" - fi - - ARGS+=("${ARG}") -done - -if [[ "${TARGET}" == "armv7-unknown-linux-musleabihf" ]]; then - # Pass `-Clinker` last to override the previous `-Clinker`. - rustc "-Lnative=${LIBSTDCXX_PATH}" "$@" "-Clinker=${LINKER}" -else - rustc "$@" -fi diff --git a/scripts/cross/wrappers/linker.sh b/scripts/cross/wrappers/linker.sh deleted file mode 100755 index b6048bd805018..0000000000000 --- a/scripts/cross/wrappers/linker.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -# This is a wrapper script around the system linker, which injects libgcc startup objects to allow -# statically linking Rust apps against C++ libraries while targeting musl. -# -# It should work as-is when using `cross` to cross-compile to musl. If not, it can be reconfigured -# via the environment variables shown below. Unfortunately it has to rely on a lot of hard-coded -# paths and arguments in order to do its job, so it may stop working when `cross` updates its Docker -# environment, or `rustc` changes the arguments it passes to the linker. -# -# Also see this link for compiler docs on which crt objects are used when: -# https://doc.rust-lang.org/nightly/nightly-rustc/rustc_target/spec/crt_objects/index.html -# -# Note that the name of this wrapper is significant: rustc automatically detects the "linker flavor" -# based on the linker executable name, and if it ends with `-ld` (which used to be the case), it -# will expect to invoke GNU LD directly. We want to use GCC instead, because it knows the search -# paths for locating the C++ runtime libraries. GCC is the default "flavor" on musl, so we just have -# to use a "neutral" wrapper name. - -set -o errexit - -# Object to inject after the predefined crt start objects. -INJECT_BEGIN=${RUST_MUSL_INJECT_BEGIN:-crtbeginS.o} - -# Object to inject before the predefined crt end objects. -INJECT_END=${RUST_MUSL_INJECT_BEGIN:-crtendS.o} - -# NB: We link the -S version of the objects because Rust produces position-independent executables. -# The non-S version fails to link in that case. - -# The linker to forward to. Must accept GCC-style arguments (so must not be LD directly). -LINKER='' -if [ -x "$(command -v x86_64-linux-musl-gcc)" ]; then - LINKER=x86_64-linux-musl-gcc -elif [ -x "$(command -v i686-linux-musl-gcc)" ]; then - LINKER=i686-linux-musl-gcc -elif [ -x "$(command -v aarch64-linux-musl-gcc)" ]; then - LINKER=aarch64-linux-musl-gcc -elif [ -x "$(command -v arm-linux-musleabihf-gcc)" ]; then - LINKER=arm-linux-musleabihf-gcc -else - LINKER=${RUST_MUSL_LINKER} -fi - -args=("-l:$INJECT_BEGIN" "$@" "-l:$INJECT_END") - -echo invoking real linker: "${LINKER}" "${args[@]}" >&2 -"${LINKER}" "${args[@]}" diff --git a/scripts/cross/wrappers/musl_rustc.sh b/scripts/cross/wrappers/musl_rustc.sh deleted file mode 100755 index 5fb992810ae3e..0000000000000 --- a/scripts/cross/wrappers/musl_rustc.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env bash - -# This is a wrapper script around `rustc`, which passes custom arguments to rustc. -# -# Normally, custom rustc arguments would be configured by setting the `rustflags` key in -# `.cargo/config.toml`, but that key is overridden by the `RUSTFLAGS` env var, which is set *inside* -# the `cross` Docker container for AArch64, so we unfortunately need this custom rustc wrapper. -# -# To make matters worse, it is not possible to override `rustc` only for a specific target, so we -# have to make sure that we *only* pass the custom arguments when the compilation target is AArch64. -# -# Ideally, `rustflags` from `.cargo/config` and the `RUSTFLAGS` env var would be merged, which is -# tracked in this Cargo issue: https://github.com/rust-lang/cargo/issues/5376 - -set -e - -SELF=$(dirname "$0") - -LIBSTDCXX_PATH="/usr/local/aarch64-linux-musl/lib" -LINKER="${SELF}/linker.sh" - -# We don't get passed the target in any env var, so we'd have to parse cli args and look for the -# `--target` flag :( -TARGET="" -ARGS=() -for ARG in "$@"; do - # FIXME: --target=bla is valid too, but we don't handle that - - if [[ "${TARGET}" == "next" ]]; then - TARGET="${ARG}" - fi - - if [[ "${ARG}" == "--target" ]]; then - TARGET="next" - fi - - ARGS+=("${ARG}") -done - -if [[ "${TARGET}" == "aarch64-unknown-linux-musl" ]]; then - # Pass `-Clinker` last to override the previous `-Clinker`. - rustc "-Lnative=${LIBSTDCXX_PATH}" "$@" "-Clinker=${LINKER}" -else - rustc "$@" -fi