Skip to content

Commit

Permalink
mk-component-set: wrap gcc-ld/ld.lld instead of multicall rust-lld
Browse files Browse the repository at this point in the history
Other flavor dispatchers may use different CLI (eg. MSVC 'link' style)
and our wrapper cannot handle all of them. They are usually used for
exotic targets like UEFI or WASM ones, where Nix libraries cannot be
used without manual configuration anyway.
  • Loading branch information
oxalica committed May 31, 2024
1 parent 095702e commit 7ab714f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 285 deletions.
281 changes: 0 additions & 281 deletions ld-wrapper.sh

This file was deleted.

9 changes: 5 additions & 4 deletions mk-component-set.nix
Original file line number Diff line number Diff line change
Expand Up @@ -124,18 +124,19 @@ let
chmod +x "$dst"
}
dsts=( "$out"/lib/rustlib/*/bin/rust-lld )
dsts=( "$out"/lib/rustlib/*/bin/gcc-ld/ld.lld )
if [[ ''${#dsts} -ne 0 ]]; then
ls -lah $out
mkdir -p $out/nix-support
substituteAll ${path + "/pkgs/build-support/wrapper-common/utils.bash"} $out/nix-support/utils.bash
substituteAll ${path + "/pkgs/build-support/bintools-wrapper/add-flags.sh"} $out/nix-support/add-flags.sh
substituteAll ${path + "/pkgs/build-support/bintools-wrapper/add-hardening.sh"} $out/nix-support/add-hardening.sh
for dst in "''${dsts[@]}"; do
unwrapped="$(dirname "$dst")/.rust-lld-unwrapped"
# The ld.lld is path/name sensitive because itself is a wrapper. Keep its original name.
unwrapped="$(dirname "$dst")-unwrapped/ld.lld"
mkdir -p "$(dirname "$unwrapped")"
mv "$dst" "$unwrapped"
wrap "$dst" ${./ld-wrapper.sh} "$unwrapped"
wrap "$dst" ${path + "/pkgs/build-support/bintools-wrapper/ld-wrapper.sh"} "$unwrapped"
done
fi
'';
Expand Down

0 comments on commit 7ab714f

Please sign in to comment.