about summary refs log tree commit diff
path: root/src/librustc_session
diff options
context:
space:
mode:
authorMateusz Mikuła <mati865@gmail.com>2020-05-28 19:54:08 +0200
committerMateusz Mikuła <mati865@gmail.com>2020-06-25 11:27:06 +0200
commit2e3f51775a6427f34878c2041be8e0c8d656ea3c (patch)
tree6a83ddce2996d250553a500a38e315d86f24293b /src/librustc_session
parent1557fb031b272b4c5bfcc7de5df7eddc7b36a584 (diff)
Add unstable rustc option to control self-contained linkage mode
Diffstat (limited to 'src/librustc_session')
-rw-r--r--src/librustc_session/filesearch.rs4
-rw-r--r--src/librustc_session/options.rs3
2 files changed, 5 insertions, 2 deletions
diff --git a/src/librustc_session/filesearch.rs b/src/librustc_session/filesearch.rs
index 5586b82b0ed..675a880cef4 100644
--- a/src/librustc_session/filesearch.rs
+++ b/src/librustc_session/filesearch.rs
@@ -92,13 +92,13 @@ impl<'a> FileSearch<'a> {
     }
 
     // Returns a list of directories where target-specific tool binaries are located.
-    pub fn get_tools_search_paths(&self) -> Vec<PathBuf> {
+    pub fn get_tools_search_paths(&self, self_contained: bool) -> Vec<PathBuf> {
         let mut p = PathBuf::from(self.sysroot);
         p.push(find_libdir(self.sysroot).as_ref());
         p.push(RUST_LIB_DIR);
         p.push(&self.triple);
         p.push("bin");
-        vec![p.clone(), p.join("self-contained")]
+        if self_contained { vec![p.clone(), p.join("self-contained")] } else { vec![p.clone()] }
     }
 }
 
diff --git a/src/librustc_session/options.rs b/src/librustc_session/options.rs
index 6c6f27502b6..055ae2fa2b5 100644
--- a/src/librustc_session/options.rs
+++ b/src/librustc_session/options.rs
@@ -888,6 +888,9 @@ options! {DebuggingOptions, DebuggingSetter, basic_debugging_options,
         "keep hygiene data after analysis (default: no)"),
     link_native_libraries: bool = (true, parse_bool, [UNTRACKED],
         "link native libraries in the linker invocation (default: yes)"),
+    link_self_contained: Option<bool> = (None, parse_opt_bool, [TRACKED],
+        "control whether to link Rust provided C objects/libraries or rely
+         on C toolchain installed in the system"),
     link_only: bool = (false, parse_bool, [TRACKED],
         "link the `.rlink` file generated by `-Z no-link` (default: no)"),
     llvm_time_trace: bool = (false, parse_bool, [UNTRACKED],