Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions lib/mk-component-set.nix
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ let
fi
''

# Darwin rustlib helper tools live under `lib/rustlib/<target>/bin`
# and use `@loader_path/../lib`, so expose rustc's LLVM dylib there.
+ optionalString (hostPlatform.isDarwin && pname == "rustc") ''
if [[ -e "$out/lib/libLLVM.dylib" ]]; then
for binDir in "$out"/lib/rustlib/*/bin; do
if [[ ! -d "$binDir" ]]; then
continue
fi
if [[ -e "$binDir/rust-lld" || -e "$binDir/rust-objcopy" || -e "$binDir/wasm-component-ld" ]]; then
libDir="$(dirname "$binDir")/lib"
mkdir -p "$libDir"
if [[ ! -e "$libDir/libLLVM.dylib" && ! -L "$libDir/libLLVM.dylib" ]]; then
ln -s ../../../libLLVM.dylib "$libDir/libLLVM.dylib"
fi
fi
done
fi
''

# Wrap the shipped `rust-lld` (lld), which is used by default on some targets.
# Unfortunately there is no hook to conveniently wrap CC tools inside
# derivation and `wrapBintools` is designed for wrapping a standalone
Expand Down
12 changes: 12 additions & 0 deletions tests/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ let
date = "2026-01-10";
version = "1.93.0-beta.6-2026-01-10";
};
sharedLlvmNightly = "2026-06-02";

in
# Check only tier 1 targets.
Expand Down Expand Up @@ -236,4 +237,15 @@ optionalAttrs
targets = [ "x86_64-apple-darwin" ];
targetExtensions = [ "rust-docs" ];
};
aarch64-darwin-rustlib-tools-shared-llvm = pkgs.runCommand "aarch64-darwin-rustlib-tools-shared-llvm" { } ''
for rustlib in \
"${nightly.${sharedLlvmNightly}.rustc}/lib/rustlib/${rustHostPlatform}" \
"${nightly.${sharedLlvmNightly}.default}/lib/rustlib/${rustHostPlatform}"
do
"$rustlib/bin/rust-lld" -flavor wasm --version
"$rustlib/bin/rust-objcopy" --version
"$rustlib/bin/wasm-component-ld" --version
done
touch "$out"
'';
}