d-add-soname
authorRust Maintainers <pkg-rust-maintainers@lists.alioth.debian.org>
Wed, 4 Jan 2017 20:34:56 +0000 (20:34 +0000)
committerXimin Luo <infinity0@debian.org>
Wed, 4 Jan 2017 20:34:56 +0000 (20:34 +0000)
Gbp-Pq: Name d-add-soname.patch

src/librustc_trans/back/link.rs

index ad8e0c1ee59f6dac0ce2f2edb7b72245733f0654..17bd30ff7ba314f69d77149320b0b9adf18c21e7 100644 (file)
@@ -848,6 +848,12 @@ fn link_args(cmd: &mut Linker,
         cmd.args(&rpath::get_rpath_flags(&mut rpath_config));
     }
 
+    if (crate_type == config::CrateTypeDylib || crate_type == config::CrateTypeCdylib) && 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 {