-
Notifications
You must be signed in to change notification settings - Fork 394
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
497: don't set RUSTFLAGS in aarch64-musl image r=reitermarkus a=japaric instead use a linker wrapper to work around issue rust-lang/rust#46651 not setting RUSTFLAGS inside the container lets end users pass rustc flags via `.cargo/config` this is an alternative to #464 that doesn't require bumping the MSRV of the `aarch64-unknown-linux-musl` target (that is the aarch64-musl image will continue to work with Rust 1.42 where bug rust-lang/rust#46651 is still presen ) Co-authored-by: Jorge Aparicio <jorge.aparicio@ferrous-systems.com>
- Loading branch information
Showing
2 changed files
with
27 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
#!/bin/bash | ||
|
||
# this linker wrapper works around issue https://github.com/rust-lang/rust/issues/46651 | ||
# which affects toolchains older than 1.48 | ||
# older toolchains require the `-lgcc` linker flag otherwise they fail to link | ||
|
||
set -euo pipefail | ||
|
||
main() { | ||
local release= | ||
release=$(rustc -Vv | grep '^release:' | cut -d ':' -f2) | ||
# NOTE we assume `major` is always "1" | ||
local minor= | ||
minor=$(echo "$release" | cut -d '.' -f2) | ||
|
||
if (( minor >= 48 )); then | ||
# no workaround | ||
aarch64-linux-musl-gcc "${@}" | ||
else | ||
# apply workaround | ||
aarch64-linux-musl-gcc "${@}" -lgcc | ||
fi | ||
} | ||
|
||
main "${@}" |