d-add-soname
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Sun, 5 Aug 2018 09:18:10 +0000 (10:18 +0100)
committerXimin Luo <infinity0@debian.org>
Sun, 5 Aug 2018 09:18:10 +0000 (10:18 +0100)
Gbp-Pq: Name d-add-soname.patch

src/librustc_codegen_llvm/back/link.rs

index 4e9910e58f391dcb79aca2626d2b1c57100cc53a..5519eb82d21d964278372db0def247e832212384 100644 (file)
@@ -1174,6 +1174,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 {