d-add-soname
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Thu, 18 Jul 2019 01:25:06 +0000 (02:25 +0100)
committerXimin Luo <infinity0@debian.org>
Thu, 18 Jul 2019 01:25:06 +0000 (02:25 +0100)
Gbp-Pq: Name d-add-soname.patch

src/librustc_codegen_ssa/back/link.rs

index d5a56f6a09e02c8c5f6db44636b19b6deeeaa84e..daa986d4950315db33904af2b8f1ff6e2bb4a024 100644 (file)
@@ -1184,6 +1184,13 @@ fn link_args<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
         cmd.args(&rpath::get_rpath_flags(&mut rpath_config));
     }
 
+    if (crate_type == config::CrateType::Dylib || crate_type == config::CrateType::Cdylib)
+       && 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 {