Skip to content

Commit 5ffae10

Browse files
committed
rustc_metadata: add shared LLVM search path for macOS rustc_private builds
1 parent d91e403 commit 5ffae10

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

compiler/rustc_metadata/src/native_libs.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ pub fn walk_native_lib_search_dirs<R>(
5757
f(&sess.target_tlib_path.dir.join("self-contained"), false)?;
5858
}
5959

60+
let has_shared_llvm_apple_darwin =
61+
sess.target.is_like_darwin && sess.target_tlib_path.dir.join("libLLVM.dylib").exists();
62+
6063
// Toolchains for some targets may ship `libunwind.a`, but place it into the main sysroot
6164
// library directory instead of the self-contained directories.
6265
// Sanitizer libraries have the same issue and are also linked by name on Apple targets.
@@ -72,7 +75,8 @@ pub fn walk_native_lib_search_dirs<R>(
7275
|| sess.target.os == Os::Linux
7376
|| sess.target.os == Os::Fuchsia
7477
|| sess.target.is_like_aix
75-
|| sess.target.is_like_darwin && !sess.sanitizers().is_empty()
78+
|| sess.target.is_like_darwin
79+
&& (!sess.sanitizers().is_empty() || has_shared_llvm_apple_darwin)
7680
|| sess.target.os == Os::Windows
7781
&& sess.target.env == Env::Gnu
7882
&& sess.target.abi == Abi::Llvm

0 commit comments

Comments
 (0)