Don’t specify linker in config
No longer needed.
Also formatting.
Change-Id: I61a6fbeec41c6d03e729ab3faff6644b0b788349
Testing: manual
diff --git a/src/lib.rs b/src/lib.rs
index a823b48..5e86567 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -18,8 +18,8 @@
use crate::cross::{pkg_config_path, run_configure, run_pkg_config};
use crate::device::{enable_networking, netaddr, netls, scp_to_device, ssh, start_emulator,
stop_emulator, StartEmulatorOptions};
-use crate::sdk::{cargo_out_dir, cargo_path, clang_archiver_path, clang_resource_dir, clang_c_compiler_path,
- clang_cpp_compiler_path, clang_linker_path, clang_ranlib_path, rustc_path,
+use crate::sdk::{cargo_out_dir, cargo_path, clang_archiver_path, clang_c_compiler_path,
+ clang_cpp_compiler_path, clang_ranlib_path, clang_resource_dir, rustc_path,
rustdoc_path, shared_libraries_path, sysroot_path, zircon_build_path};
use crate::utils::strip_binary;
@@ -466,19 +466,22 @@
let target_triple = get_target_triple(target_options);
let sysroot_lib_pathbuf = sysroot_as_path.join("lib");
let sysroot_lib = sysroot_lib_pathbuf.to_str().unwrap();
- let clang_resource_lib =
- clang_resource_dir(&target_triple)?
- .join(&target_triple)
- .join("lib");
+ let clang_resource_lib = clang_resource_dir(&target_triple)?
+ .join(&target_triple)
+ .join("lib");
let mut rust_flags = vec![
- "-L".to_string(), sysroot_lib.to_string(),
+ "-L".to_string(),
+ sysroot_lib.to_string(),
"-Clink-arg=--pack-dyn-relocs=relr".to_string(),
"-Clink-arg=--threads".to_string(),
format!("-Clink-arg=-L{}", sysroot_lib),
format!("-Clink-arg=-L{}", clang_resource_lib.to_str().unwrap()),
format!("-Clink-arg=--sysroot={}", sysroot_as_path.to_str().unwrap()),
- format!("-Lnative={}", shared_libraries_path(target_options)?.to_str().unwrap()),
+ format!(
+ "-Lnative={}",
+ shared_libraries_path(target_options)?.to_str().unwrap()
+ ),
];
if get_triple_cpu(target_options) == "aarch64" {
@@ -508,11 +511,9 @@
fs::canonicalize(std::env::current_exe()?)?
};
- let mut runner_args = vec![
- fargo_path
- .to_str()
- .ok_or_else(|| err_msg("unable to convert path to utf8 encoding"))?,
- ];
+ let mut runner_args = vec![fargo_path
+ .to_str()
+ .ok_or_else(|| err_msg("unable to convert path to utf8 encoding"))?];
if options.verbose {
runner_args.push("-v");
@@ -719,11 +720,6 @@
)?;
writeln!(
config,
- "linker = \"{}\"",
- clang_linker_path()?.to_str().unwrap()
- )?;
- writeln!(
- config,
"runner = \"{}\"",
make_fargo_command(None, options, true, target_options, None)?
)?;
diff --git a/src/sdk.rs b/src/sdk.rs
index 110dbea..46c6ac6 100644
--- a/src/sdk.rs
+++ b/src/sdk.rs
@@ -187,10 +187,6 @@
Ok(buildtools_path()?.join("clang"))
}
-pub fn clang_linker_path() -> Result<PathBuf, Error> {
- Ok(clang_base_path()?.join("bin").join("clang"))
-}
-
pub fn clang_c_compiler_path() -> Result<PathBuf, Error> {
Ok(clang_base_path()?.join("bin").join("clang"))
}
@@ -217,12 +213,14 @@
.context("Running `clang` to get resource dir")?;
if !output.status.success() {
- bail!("Failed to get `clang` resource dir: {}",
- String::from_utf8_lossy(&output.stderr));
+ bail!(
+ "Failed to get `clang` resource dir: {}",
+ String::from_utf8_lossy(&output.stderr)
+ );
}
- let path_string = String::from_utf8(output.stdout)
- .context("Invalid UTF8 in `clang` resource dir")?;
+ let path_string =
+ String::from_utf8(output.stdout).context("Invalid UTF8 in `clang` resource dir")?;
Ok(PathBuf::from(path_string.trim()))
}