d-add-soname
authorRust Maintainers <pkg-rust-maintainers@lists.alioth.debian.org>
Sun, 8 Jul 2018 19:39:35 +0000 (20:39 +0100)
committerMoritz Mühlenhoff <jmm@debian.org>
Sun, 8 Jul 2018 19:39:35 +0000 (20:39 +0100)
Gbp-Pq: Name d-add-soname.patch

src/librustc_trans/back/link.rs

index abd02e719fa8d67f21adbc4afc3a19a7655d7acb..fe58fcea9cabf1865168ed2418aa5f2bdd8605a8 100644 (file)
@@ -1015,6 +1015,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 {