@@ -2066,16 +2066,20 @@ fn add_local_crate_metadata_objects(
2066
2066
2067
2067
/// Add sysroot and other globally set directories to the directory search list.
2068
2068
fn add_library_search_dirs ( cmd : & mut dyn Linker , sess : & Session , self_contained : bool ) {
2069
- // The default library location, we need this to find the runtime.
2070
- // The location of crates will be determined as needed.
2071
- let lib_path = sess. target_filesearch ( PathKind :: All ) . get_lib_path ( ) ;
2072
- cmd. include_path ( & fix_windows_verbatim_for_gcc ( & lib_path) ) ;
2073
-
2074
2069
// Special directory with libraries used only in self-contained linkage mode
2075
2070
if self_contained {
2076
2071
let lib_path = sess. target_filesearch ( PathKind :: All ) . get_self_contained_lib_path ( ) ;
2077
2072
cmd. include_path ( & fix_windows_verbatim_for_gcc ( & lib_path) ) ;
2078
2073
}
2074
+
2075
+ // The default library location, we need this to find the runtime.
2076
+ // The location of crates will be determined as needed.
2077
+ // `copy_third_party_objects`
2078
+ if sess. target . vendor == "fortanix" || sess. target . os == "linux" || sess. target . os == "fuchsia"
2079
+ {
2080
+ let lib_path = sess. target_filesearch ( PathKind :: Native ) . get_lib_path ( ) ;
2081
+ cmd. include_path ( & fix_windows_verbatim_for_gcc ( & lib_path) ) ;
2082
+ }
2079
2083
}
2080
2084
2081
2085
/// Add options making relocation sections in the produced ELF files read-only
@@ -2638,14 +2642,13 @@ fn add_local_native_libraries(
2638
2642
link_output_kind : LinkOutputKind ,
2639
2643
) {
2640
2644
if sess. opts . unstable_opts . link_native_libraries {
2641
- // User-supplied library search paths (-L on the command line). These are the same paths
2642
- // used to find Rust crates, so some of them may have been added already by the previous
2643
- // crate linking code. This only allows them to be found at compile time so it is still
2644
- // entirely up to outside forces to make sure that library can be found at runtime.
2645
- for search_path in sess. target_filesearch ( PathKind :: All ) . search_paths ( ) {
2646
- match search_path. kind {
2647
- PathKind :: Framework => cmd. framework_path ( & search_path. dir ) ,
2648
- _ => cmd. include_path ( & fix_windows_verbatim_for_gcc ( & search_path. dir ) ) ,
2645
+ for search_path in sess. target_filesearch ( PathKind :: Native ) . cli_search_paths ( ) {
2646
+ cmd. include_path ( & fix_windows_verbatim_for_gcc ( & search_path. dir ) ) ;
2647
+ }
2648
+ for search_path in sess. target_filesearch ( PathKind :: Framework ) . cli_search_paths ( ) {
2649
+ // Contrary to the `-L` docs only framework-specific paths are considered here.
2650
+ if search_path. kind != PathKind :: All {
2651
+ cmd. framework_path ( & search_path. dir ) ;
2649
2652
}
2650
2653
}
2651
2654
}
@@ -3012,9 +3015,9 @@ fn add_apple_sdk(cmd: &mut dyn Linker, sess: &Session, flavor: LinkerFlavor) {
3012
3015
// search path.
3013
3016
3014
3017
// The flags are called `-L` and `-F` both in Clang, ld64 and ldd.
3015
- let sdk_root = Path :: new ( & sdk_root) ;
3016
- cmd. include_path ( & sdk_root. join ( "System/iOSSupport/usr/lib" ) ) ;
3017
- cmd. framework_path ( & sdk_root. join ( "System/iOSSupport/System/Library/Frameworks" ) ) ;
3018
+ // let sdk_root = Path::new(&sdk_root);
3019
+ // cmd.include_path(&sdk_root.join("System/iOSSupport/usr/lib"));
3020
+ // cmd.framework_path(&sdk_root.join("System/iOSSupport/System/Library/Frameworks"));
3018
3021
}
3019
3022
}
3020
3023
0 commit comments