From 8e9a79091f6f62a232bca3e86fb58eac0611d18a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mateusz=20Miku=C5=82a?= Date: Sun, 15 Feb 2026 17:37:15 +0100 Subject: [PATCH] Add LLVM lib location to the linker search paths --- compiler/rustc_metadata/src/native_libs.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/compiler/rustc_metadata/src/native_libs.rs b/compiler/rustc_metadata/src/native_libs.rs index b160b3fe9bb3..182ed433bb4f 100644 --- a/compiler/rustc_metadata/src/native_libs.rs +++ b/compiler/rustc_metadata/src/native_libs.rs @@ -61,6 +61,8 @@ pub fn walk_native_lib_search_dirs( // library directory instead of the self-contained directories. // Sanitizer libraries have the same issue and are also linked by name on Apple targets. // The targets here should be in sync with `copy_third_party_objects` in bootstrap. + // Finally there is shared LLVM library, which unlike compiler libraries, is linked by the name, + // therefore requiring the search path for the linker. // FIXME: implement `-Clink-self-contained=+/-unwind,+/-sanitizers`, move the shipped libunwind // and sanitizers to self-contained directory, and stop adding this search path. // FIXME: On AIX this also has the side-effect of making the list of library search paths @@ -71,6 +73,9 @@ pub fn walk_native_lib_search_dirs( || sess.target.os == Os::Fuchsia || sess.target.is_like_aix || sess.target.is_like_darwin && !sess.sanitizers().is_empty() + || sess.target.os == Os::Windows + && sess.target.env == Env::Gnu + && sess.target.abi == Abi::Llvm { f(&sess.target_tlib_path.dir, false)?; }