d-add-soname
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Sun, 17 Mar 2019 23:40:05 +0000 (23:40 +0000)
committerXimin Luo <infinity0@debian.org>
Sun, 17 Mar 2019 23:40:05 +0000 (23:40 +0000)
Gbp-Pq: Name d-add-soname.patch

src/librustc_codegen_llvm/back/link.rs

index 68da14570e4479a04bf583b8352233479fc2e888..4e140846c376b6e60b852e52aadcb36d3555716a 100644 (file)
@@ -1045,6 +1045,13 @@ fn link_args(cmd: &mut dyn Linker,
         cmd.args(&rpath::get_rpath_flags(&mut rpath_config));
     }
 
+    if (crate_type == config::CrateType::Dylib || crate_type == config::CrateType::Cdylib)
+       && t.options.linker_is_gnu {
+        let filename = String::from(out_filename.file_name().unwrap().to_str().unwrap());
+        let soname = [String::from("-Wl,-soname=") + &filename];
+        cmd.args(&soname);
+    }
+
     // Finally add all the linker arguments provided on the command line along
     // with any #[link_args] attributes found inside the crate
     if let Some(ref args) = sess.opts.cg.link_args {