From 4023e5df7ebc2e50289c9828e374b0bf901a219d Mon Sep 17 00:00:00 2001 From: O01eg Date: Sun, 1 Mar 2020 14:33:52 +0300 Subject: [PATCH] Expose target libdir information via print command. With custom libdir it is required to have an access to library placement. --- src/librustc_driver/lib.rs | 4 ++++ src/librustc_session/config.rs | 2 ++ 2 files changed, 6 insertions(+) diff --git a/src/librustc_driver/lib.rs b/src/librustc_driver/lib.rs index 9a94349e5fde4..5089a14a34c1b 100644 --- a/src/librustc_driver/lib.rs +++ b/src/librustc_driver/lib.rs @@ -676,6 +676,10 @@ impl RustcDefaultCalls { println!("{}", targets.join("\n")); } Sysroot => println!("{}", sess.sysroot.display()), + TargetLibdir => println!( + "{}", + sess.target_tlib_path.as_ref().unwrap_or(&sess.host_tlib_path).dir.display() + ), TargetSpec => println!("{}", sess.target.target.to_json().pretty()), FileNames | CrateName => { let input = input.unwrap_or_else(|| { diff --git a/src/librustc_session/config.rs b/src/librustc_session/config.rs index db4412a18a35b..60f25871dd9dd 100644 --- a/src/librustc_session/config.rs +++ b/src/librustc_session/config.rs @@ -391,6 +391,7 @@ impl ExternEntry { pub enum PrintRequest { FileNames, Sysroot, + TargetLibdir, CrateName, Cfg, TargetList, @@ -1344,6 +1345,7 @@ fn collect_print_requests( "crate-name" => PrintRequest::CrateName, "file-names" => PrintRequest::FileNames, "sysroot" => PrintRequest::Sysroot, + "target-libdir" => PrintRequest::TargetLibdir, "cfg" => PrintRequest::Cfg, "target-list" => PrintRequest::TargetList, "target-cpus" => PrintRequest::TargetCPUs,