d-add-soname
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Wed, 25 Jul 2018 04:35:56 +0000 (05:35 +0100)
committerXimin Luo <infinity0@debian.org>
Wed, 25 Jul 2018 04:35:56 +0000 (05:35 +0100)
Gbp-Pq: Name d-add-soname.patch

src/librustc_trans/back/link.rs

index 92f9a9e8ba97464d0a0ef800268bec7fd8ed17f4..d64e40fd0cf24db3e5681b90ad1b2a7853aad456 100644 (file)
@@ -1151,6 +1151,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 {