d-add-soname
authorDebian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
Fri, 2 Nov 2018 08:42:36 +0000 (08:42 +0000)
committerXimin Luo <infinity0@debian.org>
Fri, 2 Nov 2018 08:42:36 +0000 (08:42 +0000)
Gbp-Pq: Name d-add-soname.patch

src/librustc_codegen_llvm/back/link.rs

index 8248385c12764949641b6be46c4a9dabb303b2da..2755e947b017715db43e303aaf2f63fc2742d566 100644 (file)
@@ -1222,6 +1222,13 @@ fn link_args(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 {