diff options
author | A. Wilcox <awilcox@wilcox-tech.com> | 2018-11-15 01:52:22 +0000 |
---|---|---|
committer | A. Wilcox <awilcox@wilcox-tech.com> | 2018-11-15 01:52:22 +0000 |
commit | 097e4722ba191ed4ab4e51766c6fe9a23a3e0ecf (patch) | |
tree | daa93c64489cab0512bad7c4e5f4b3b848bf7859 /user/rust/0004-Require-static-native-libraries-when-linking-static-.patch | |
parent | 950827890cca5caf633480047da6115f43b1a529 (diff) | |
parent | 18b490b7953735328501c6f7e54522a91220caf3 (diff) | |
download | packages-097e4722ba191ed4ab4e51766c6fe9a23a3e0ecf.tar.gz packages-097e4722ba191ed4ab4e51766c6fe9a23a3e0ecf.tar.bz2 packages-097e4722ba191ed4ab4e51766c6fe9a23a3e0ecf.tar.xz packages-097e4722ba191ed4ab4e51766c6fe9a23a3e0ecf.zip |
Merge branch 'rust' into 'master'
user/rust: Bump to 1.30.1
See merge request !105
Diffstat (limited to 'user/rust/0004-Require-static-native-libraries-when-linking-static-.patch')
-rw-r--r-- | user/rust/0004-Require-static-native-libraries-when-linking-static-.patch | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/user/rust/0004-Require-static-native-libraries-when-linking-static-.patch b/user/rust/0004-Require-static-native-libraries-when-linking-static-.patch new file mode 100644 index 000000000..e6f5304ec --- /dev/null +++ b/user/rust/0004-Require-static-native-libraries-when-linking-static-.patch @@ -0,0 +1,50 @@ +From 8912b0e6b881fda271f3805622442e4d5ac1e286 Mon Sep 17 00:00:00 2001 +From: Samuel Holland <samuel@sholland.org> +Date: Fri, 8 Sep 2017 00:05:18 -0500 +Subject: [PATCH 04/24] Require static native libraries when linking static + executables + +gcc/ld will create a dynamically-linked executable without warning, even +when passed `-static`, when asked to link to a `.so`. Avoid this +confusing and unintended behavior by always using the static version of +libraries when trying to link static executables. + +Fixes #54243 +--- + src/librustc_codegen_llvm/back/link.rs | 13 ++++++++++--- + 1 file changed, 10 insertions(+), 3 deletions(-) + +diff --git a/src/librustc_codegen_llvm/back/link.rs b/src/librustc_codegen_llvm/back/link.rs +index 8248385c12..9fc1991412 100644 +--- a/src/librustc_codegen_llvm/back/link.rs ++++ b/src/librustc_codegen_llvm/back/link.rs +@@ -1592,8 +1592,8 @@ fn add_upstream_rust_crates(cmd: &mut dyn Linker, + } + } + +-// Link in all of our upstream crates' native dependencies. Remember that +-// all of these upstream native dependencies are all non-static ++// Link in all of our upstream crates' native dependencies. Remember that when ++// linking libraries, these upstream native dependencies are all non-static + // dependencies. We've got two cases then: + // + // 1. The upstream crate is an rlib. In this case we *must* link in the +@@ -1637,7 +1637,14 @@ fn add_upstream_native_libraries(cmd: &mut dyn Linker, + continue + } + match lib.kind { +- NativeLibraryKind::NativeUnknown => cmd.link_dylib(&name.as_str()), ++ NativeLibraryKind::NativeUnknown => { ++ // When creating executables, match library linkage to that of the executable. ++ if crate_type == config::CrateType::Executable && sess.crt_static() { ++ cmd.link_staticlib(&name.as_str()) ++ } else { ++ cmd.link_dylib(&name.as_str()) ++ } ++ }, + NativeLibraryKind::NativeFramework => cmd.link_framework(&name.as_str()), + NativeLibraryKind::NativeStaticNobundle => { + // Link "static-nobundle" native libs only if the crate they originate from +-- +2.18.0 + |