From: Debian Rust Maintainers Date: Sun, 16 Dec 2018 22:34:44 +0000 (+0000) Subject: d-add-soname X-Git-Tag: archive/raspbian/1.31.0+dfsg1-2+rpi1^2~7 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=258762f6e868738d48e958e6b3f8dc3cc0793c7f;p=rustc.git d-add-soname Gbp-Pq: Name d-add-soname.patch --- diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs index 86c6a5e65b..96a5ed6ef5 100644 --- a/src/librustc_codegen_llvm/back/link.rs +++ b/src/librustc_codegen_llvm/back/link.rs @@ -1218,6 +1218,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 {