about summary refs log tree commit diff
path: root/src/librustc_codegen_llvm/back/archive.rs
diff options
context:
space:
mode:
authorbjorn3 <bjorn3@users.noreply.github.com>2018-10-20 14:45:08 +0200
committerbjorn3 <bjorn3@users.noreply.github.com>2018-11-03 13:35:09 +0100
commit942864a000efd74b73e36bda5606b2cdb55ecf39 (patch)
treefef4edea7e3d19df313b0ad149238ecf4ec91b6b /src/librustc_codegen_llvm/back/archive.rs
parentb6e8f9dbdc4f154d799589ce5e21c020c51f2123 (diff)
downloadrust-942864a000efd74b73e36bda5606b2cdb55ecf39.tar.gz
rust-942864a000efd74b73e36bda5606b2cdb55ecf39.zip
Move cg_llvm::back::linker to cg_utils
Diffstat (limited to 'src/librustc_codegen_llvm/back/archive.rs')
-rw-r--r--src/librustc_codegen_llvm/back/archive.rs24
1 files changed, 1 insertions, 23 deletions
diff --git a/src/librustc_codegen_llvm/back/archive.rs b/src/librustc_codegen_llvm/back/archive.rs
index af9efc6d7c4..ce4cb1ea3a0 100644
--- a/src/librustc_codegen_llvm/back/archive.rs
+++ b/src/librustc_codegen_llvm/back/archive.rs
@@ -52,28 +52,6 @@ enum Addition {
     },
 }
 
-pub fn find_library(name: &str, search_paths: &[PathBuf], sess: &Session)
-                    -> PathBuf {
-    // On Windows, static libraries sometimes show up as libfoo.a and other
-    // times show up as foo.lib
-    let oslibname = format!("{}{}{}",
-                            sess.target.target.options.staticlib_prefix,
-                            name,
-                            sess.target.target.options.staticlib_suffix);
-    let unixlibname = format!("lib{}.a", name);
-
-    for path in search_paths {
-        debug!("looking for {} inside {:?}", name, path);
-        let test = path.join(&oslibname);
-        if test.exists() { return test }
-        if oslibname != unixlibname {
-            let test = path.join(&unixlibname);
-            if test.exists() { return test }
-        }
-    }
-    sess.fatal(&format!("could not find native static library `{}`, \
-                         perhaps an -L flag is missing?", name));
-}
 
 fn is_relevant_child(c: &Child) -> bool {
     match c.name() {
@@ -128,7 +106,7 @@ impl<'a> ArchiveBuilder<'a> {
     /// Adds all of the contents of a native library to this archive. This will
     /// search in the relevant locations for a library named `name`.
     pub fn add_native_library(&mut self, name: &str) {
-        let location = find_library(name, &self.config.lib_search_paths,
+        let location = ::rustc_codegen_utils::find_library(name, &self.config.lib_search_paths,
                                     self.config.sess);
         self.add_archive(&location, |_| false).unwrap_or_else(|e| {
             self.config.sess.fatal(&format!("failed to add native library {}: {}",