d-add-soname
authorRust Maintainers <pkg-rust-maintainers@lists.alioth.debian.org>
Sat, 8 Jul 2017 23:35:25 +0000 (00:35 +0100)
committerPeter Michael Green <plugwash@raspbian.org>
Sat, 8 Jul 2017 23:35:25 +0000 (00:35 +0100)
Gbp-Pq: Name d-add-soname.patch

src/librustc_trans/back/link.rs

index defbb44448a9f3a5f4b7ce77ecc494086f5a9f61..dc3975bfc8fed403a0a740b009e85e976f7a20f1 100644 (file)
@@ -927,6 +927,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 {