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

src/librustc_codegen_llvm/back/link.rs

index 845a66c6e4436efaae724d841122619ab335dc20..10945891a42f7d814d35d9c96a77c38708e1ab0f 100644 (file)
@@ -1181,6 +1181,13 @@ fn link_args(cmd: &mut dyn 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 {