diff --git a/compiler/rustc_codegen_ssa/src/back/link.rs b/compiler/rustc_codegen_ssa/src/back/link.rs index bd07e294d211..303a0c20a55d 100644 --- a/compiler/rustc_codegen_ssa/src/back/link.rs +++ b/compiler/rustc_codegen_ssa/src/back/link.rs @@ -2065,16 +2065,20 @@ fn add_local_crate_metadata_objects( } /// Add sysroot and other globally set directories to the directory search list. -fn add_library_search_dirs(_cmd: &mut dyn Linker, sess: &Session, self_contained: bool) { - // The default library location, we need this to find the runtime. - // The location of crates will be determined as needed. - let _lib_path = sess.target_filesearch(PathKind::All).get_lib_path(); - // cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); - +fn add_library_search_dirs(cmd: &mut dyn Linker, sess: &Session, self_contained: bool) { // Special directory with libraries used only in self-contained linkage mode if self_contained { - let _lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path(); - // cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); + let lib_path = sess.target_filesearch(PathKind::All).get_self_contained_lib_path(); + cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); + } + + // The default library location, we need this to find the runtime. + // The location of crates will be determined as needed. + // `copy_third_party_objects` + if sess.target.vendor == "fortanix" || sess.target.os == "linux" || sess.target.os == "fuchsia" + { + let lib_path = sess.target_filesearch(PathKind::Native).get_lib_path(); + cmd.include_path(&fix_windows_verbatim_for_gcc(&lib_path)); } }