d-add-soname
authorRust Maintainers <pkg-rust-maintainers@lists.alioth.debian.org>
Mon, 6 Nov 2017 09:03:32 +0000 (09:03 +0000)
committerXimin Luo <infinity0@debian.org>
Mon, 6 Nov 2017 09:03:32 +0000 (09:03 +0000)
Gbp-Pq: Name d-add-soname.patch

src/librustc_trans/back/link.rs

index 5de48fbce9da90b88959ba829bffa683908f14a2..22a16eb7c61ee925e33b828147b1c545473c19f2 100644 (file)
@@ -1017,6 +1017,13 @@ 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 {