aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAric Belsito <lluixhi@gmail.com>2018-05-11 12:33:53 -0700
committerAric Belsito <lluixhi@gmail.com>2018-05-11 12:33:53 -0700
commit23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe (patch)
tree72ea8a9aca7970a365b20beec9701d9b2d4e4d4e /dev-lang/rust/files
parentx11-base/xorg-server - bug #653688 patch inclusion (diff)
downloadmusl-23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe.tar.gz
musl-23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe.tar.bz2
musl-23a3ae0b21d3a87a6d40fc515a1130d69fd1bdfe.zip
dev-lang/rust: version bump to 1.25.0
Diffstat (limited to 'dev-lang/rust/files')
-rw-r--r--dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch44
-rw-r--r--dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch416
-rw-r--r--dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch25
-rw-r--r--dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch24
-rw-r--r--dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch26
-rw-r--r--dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch36
-rw-r--r--dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch41
-rw-r--r--dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch36
-rw-r--r--dev-lang/rust/files/1.25.0/0009-liblibc.patch17
-rw-r--r--dev-lang/rust/files/1.25.0/0010-llvm.patch20
10 files changed, 685 insertions, 0 deletions
diff --git a/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch
new file mode 100644
index 00000000..d307a953
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0001-Require-static-native-libraries-when-linking-static-.patch
@@ -0,0 +1,44 @@
+From 9da9c2f708e0de229a22a2fa8caf34d4c1d6346b Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 8 Sep 2017 00:05:18 -0500
+Subject: [PATCH 1/8] Require static native libraries when linking static
+ executables
+
+---
+ src/librustc_trans/back/link.rs | 13 ++++++++++---
+ 1 file changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/src/librustc_trans/back/link.rs b/src/librustc_trans/back/link.rs
+index 87464ab0d0..395ee2a03b 100644
+--- a/src/librustc_trans/back/link.rs
++++ b/src/librustc_trans/back/link.rs
+@@ -1329,8 +1329,8 @@ fn add_upstream_rust_crates(cmd: &mut 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
+@@ -1370,7 +1370,14 @@ fn add_upstream_native_libraries(cmd: &mut Linker,
+ continue
+ }
+ match lib.kind {
+- NativeLibraryKind::NativeUnknown => cmd.link_dylib(&lib.name.as_str()),
++ NativeLibraryKind::NativeUnknown => {
++ // When creating executables, match library linkage to that of the executable.
++ if crate_type == config::CrateTypeExecutable && sess.crt_static() {
++ cmd.link_staticlib(&lib.name.as_str())
++ } else {
++ cmd.link_dylib(&lib.name.as_str())
++ }
++ },
+ NativeLibraryKind::NativeFramework => cmd.link_framework(&lib.name.as_str()),
+ NativeLibraryKind::NativeStaticNobundle => {
+ // Link "static-nobundle" native libs only if the crate they originate from
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
new file mode 100644
index 00000000..6b50eda3
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0002-Remove-nostdlib-and-musl_root-from-musl-targets.patch
@@ -0,0 +1,416 @@
+From 618ef1bcd4db1c556d482ee3b4292a3746542e57 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 8 Sep 2017 22:11:14 -0500
+Subject: [PATCH 2/8] Remove -nostdlib and musl_root from musl targets
+
+---
+ config.toml.example | 6 -----
+ src/bootstrap/bin/rustc.rs | 10 -------
+ src/bootstrap/cc_detect.rs | 27 +++----------------
+ src/bootstrap/compile.rs | 31 ----------------------
+ src/bootstrap/config.rs | 7 -----
+ src/bootstrap/configure.py | 20 --------------
+ src/bootstrap/lib.rs | 8 ------
+ src/bootstrap/sanity.rs | 30 +--------------------
+ .../docker/dist-i586-gnu-i586-i686-musl/Dockerfile | 2 --
+ src/ci/docker/dist-various-1/Dockerfile | 6 -----
+ src/ci/docker/dist-x86_64-musl/Dockerfile | 1 -
+ src/librustc_back/target/linux_musl_base.rs | 15 -----------
+ 12 files changed, 4 insertions(+), 159 deletions(-)
+
+diff --git a/config.toml.example b/config.toml.example
+index f153562a53..db08485322 100644
+--- a/config.toml.example
++++ b/config.toml.example
+@@ -372,12 +372,6 @@
+ # only use static libraries. If unset, the target's default linkage is used.
+ #crt-static = false
+
+-# The root location of the MUSL installation directory. The library directory
+-# will also need to contain libunwind.a for an unwinding implementation. Note
+-# that this option only makes sense for MUSL targets that produce statically
+-# linked binaries
+-#musl-root = "..."
+-
+ # Used in testing for configuring where the QEMU images are located, you
+ # probably don't want to use this.
+ #qemu-rootfs = "..."
+diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
+index 55d104b182..afd28c1b66 100644
+--- a/src/bootstrap/bin/rustc.rs
++++ b/src/bootstrap/bin/rustc.rs
+@@ -30,7 +30,6 @@
+ extern crate bootstrap;
+
+ use std::env;
+-use std::ffi::OsString;
+ use std::str::FromStr;
+ use std::path::PathBuf;
+ use std::process::{Command, ExitStatus};
+@@ -111,15 +110,6 @@ fn main() {
+ cmd.arg("-Cprefer-dynamic");
+ }
+
+- // Help the libc crate compile by assisting it in finding the MUSL
+- // native libraries.
+- if let Some(s) = env::var_os("MUSL_ROOT") {
+- let mut root = OsString::from("native=");
+- root.push(&s);
+- root.push("/lib");
+- cmd.arg("-L").arg(&root);
+- }
+-
+ // Override linker if necessary.
+ if let Ok(target_linker) = env::var("RUSTC_TARGET_LINKER") {
+ cmd.arg(format!("-Clinker={}", target_linker));
+diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
+index e531fdaf29..3f49a2cfec 100644
+--- a/src/bootstrap/cc_detect.rs
++++ b/src/bootstrap/cc_detect.rs
+@@ -84,7 +84,7 @@ pub fn find(build: &mut Build) {
+ if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
+ cfg.compiler(cc);
+ } else {
+- set_compiler(&mut cfg, Language::C, target, config, build);
++ set_compiler(&mut cfg, Language::C, target, config);
+ }
+
+ let compiler = cfg.get_compiler();
+@@ -112,7 +112,7 @@ pub fn find(build: &mut Build) {
+ if let Some(cxx) = config.and_then(|c| c.cxx.as_ref()) {
+ cfg.compiler(cxx);
+ } else {
+- set_compiler(&mut cfg, Language::CPlusPlus, host, config, build);
++ set_compiler(&mut cfg, Language::CPlusPlus, host, config);
+ }
+ let compiler = cfg.get_compiler();
+ build.verbose(&format!("CXX_{} = {:?}", host, compiler.path()));
+@@ -123,8 +123,7 @@ pub fn find(build: &mut Build) {
+ fn set_compiler(cfg: &mut cc::Build,
+ compiler: Language,
+ target: Interned<String>,
+- config: Option<&Target>,
+- build: &Build) {
++ config: Option<&Target>) {
+ match &*target {
+ // When compiling for android we may have the NDK configured in the
+ // config.toml in which case we look there. Otherwise the default
+@@ -161,26 +160,6 @@ fn set_compiler(cfg: &mut cc::Build,
+ }
+ }
+
+- "mips-unknown-linux-musl" => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- cfg.compiler("mips-linux-musl-gcc");
+- }
+- }
+- "mipsel-unknown-linux-musl" => {
+- if cfg.get_compiler().path().to_str() == Some("gcc") {
+- cfg.compiler("mipsel-linux-musl-gcc");
+- }
+- }
+-
+- t if t.contains("musl") => {
+- if let Some(root) = build.musl_root(target) {
+- let guess = root.join("bin/musl-gcc");
+- if guess.exists() {
+- cfg.compiler(guess);
+- }
+- }
+- }
+-
+ _ => {}
+ }
+ }
+diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
+index c85b04ddc0..c01c2341dd 100644
+--- a/src/bootstrap/compile.rs
++++ b/src/bootstrap/compile.rs
+@@ -78,13 +78,6 @@ impl Step for Std {
+ });
+ println!("Uplifting stage1 std ({} -> {})", from.host, target);
+
+- // Even if we're not building std this stage, the new sysroot must
+- // still contain the musl startup objects.
+- if target.contains("musl") {
+- let libdir = builder.sysroot_libdir(compiler, target);
+- copy_musl_third_party_objects(build, target, &libdir);
+- }
+-
+ builder.ensure(StdLink {
+ compiler: from,
+ target_compiler: compiler,
+@@ -97,11 +90,6 @@ impl Step for Std {
+ println!("Building stage{} std artifacts ({} -> {})", compiler.stage,
+ &compiler.host, target);
+
+- if target.contains("musl") {
+- let libdir = builder.sysroot_libdir(compiler, target);
+- copy_musl_third_party_objects(build, target, &libdir);
+- }
+-
+ let out_dir = build.stage_out(compiler, Mode::Libstd);
+ build.clear_if_dirty(&out_dir, &builder.rustc(compiler));
+ let mut cargo = builder.cargo(compiler, Mode::Libstd, target, "build");
+@@ -119,20 +107,6 @@ impl Step for Std {
+ }
+ }
+
+-/// Copies the crt(1,i,n).o startup objects
+-///
+-/// Since musl supports fully static linking, we can cross link for it even
+-/// with a glibc-targeting toolchain, given we have the appropriate startup
+-/// files. As those shipped with glibc won't work, copy the ones provided by
+-/// musl so we have them on linux-gnu hosts.
+-fn copy_musl_third_party_objects(build: &Build,
+- target: Interned<String>,
+- into: &Path) {
+- for &obj in &["crt1.o", "crti.o", "crtn.o"] {
+- copy(&build.musl_root(target).unwrap().join("lib").join(obj), &into.join(obj));
+- }
+-}
+-
+ /// Configure cargo to compile the standard library, adding appropriate env vars
+ /// and such.
+ pub fn std_cargo(build: &Build,
+@@ -174,11 +148,6 @@ pub fn std_cargo(build: &Build,
+ cargo.env("JEMALLOC_OVERRIDE", jemalloc);
+ }
+ }
+- if target.contains("musl") {
+- if let Some(p) = build.musl_root(target) {
+- cargo.env("MUSL_ROOT", p);
+- }
+- }
+ }
+
+ #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
+diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
+index f3810ac869..87f4fb0fae 100644
+--- a/src/bootstrap/config.rs
++++ b/src/bootstrap/config.rs
+@@ -119,8 +119,6 @@ pub struct Config {
+ pub test_miri: bool,
+ pub save_toolstates: Option<PathBuf>,
+
+- // Fallback musl-root for all targets
+- pub musl_root: Option<PathBuf>,
+ pub prefix: Option<PathBuf>,
+ pub sysconfdir: Option<PathBuf>,
+ pub datadir: Option<PathBuf>,
+@@ -152,7 +150,6 @@ pub struct Target {
+ pub linker: Option<PathBuf>,
+ pub ndk: Option<PathBuf>,
+ pub crt_static: Option<bool>,
+- pub musl_root: Option<PathBuf>,
+ pub qemu_rootfs: Option<PathBuf>,
+ }
+
+@@ -277,7 +274,6 @@ struct Rust {
+ backtrace: Option<bool>,
+ default_linker: Option<String>,
+ channel: Option<String>,
+- musl_root: Option<String>,
+ rpath: Option<bool>,
+ optimize_tests: Option<bool>,
+ debuginfo_tests: Option<bool>,
+@@ -304,7 +300,6 @@ struct TomlTarget {
+ linker: Option<String>,
+ android_ndk: Option<String>,
+ crt_static: Option<bool>,
+- musl_root: Option<String>,
+ qemu_rootfs: Option<String>,
+ }
+
+@@ -479,7 +474,6 @@ impl Config {
+ set(&mut config.wasm_syscall, rust.wasm_syscall);
+ config.rustc_parallel_queries = rust.experimental_parallel_queries.unwrap_or(false);
+ config.rustc_default_linker = rust.default_linker.clone();
+- config.musl_root = rust.musl_root.clone().map(PathBuf::from);
+ config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
+
+ if let Some(ref backends) = rust.codegen_backends {
+@@ -513,7 +507,6 @@ impl Config {
+ target.ar = cfg.ar.clone().map(PathBuf::from);
+ target.linker = cfg.linker.clone().map(PathBuf::from);
+ target.crt_static = cfg.crt_static.clone();
+- target.musl_root = cfg.musl_root.clone().map(PathBuf::from);
+ target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
+
+ config.target_config.insert(INTERNER.intern_string(triple.clone()), target);
+diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
+index 99a3ee4e4c..5357d3a3fb 100755
+--- a/src/bootstrap/configure.py
++++ b/src/bootstrap/configure.py
+@@ -106,26 +106,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
+ "aarch64-linux-android NDK standalone path")
+ v("x86_64-linux-android-ndk", "target.x86_64-linux-android.android-ndk",
+ "x86_64-linux-android NDK standalone path")
+-v("musl-root", "target.x86_64-unknown-linux-musl.musl-root",
+- "MUSL root installation directory (deprecated)")
+-v("musl-root-x86_64", "target.x86_64-unknown-linux-musl.musl-root",
+- "x86_64-unknown-linux-musl install directory")
+-v("musl-root-i586", "target.i586-unknown-linux-musl.musl-root",
+- "i586-unknown-linux-musl install directory")
+-v("musl-root-i686", "target.i686-unknown-linux-musl.musl-root",
+- "i686-unknown-linux-musl install directory")
+-v("musl-root-arm", "target.arm-unknown-linux-musleabi.musl-root",
+- "arm-unknown-linux-musleabi install directory")
+-v("musl-root-armhf", "target.arm-unknown-linux-musleabihf.musl-root",
+- "arm-unknown-linux-musleabihf install directory")
+-v("musl-root-armv7", "target.armv7-unknown-linux-musleabihf.musl-root",
+- "armv7-unknown-linux-musleabihf install directory")
+-v("musl-root-aarch64", "target.aarch64-unknown-linux-musl.musl-root",
+- "aarch64-unknown-linux-musl install directory")
+-v("musl-root-mips", "target.mips-unknown-linux-musl.musl-root",
+- "mips-unknown-linux-musl install directory")
+-v("musl-root-mipsel", "target.mipsel-unknown-linux-musl.musl-root",
+- "mipsel-unknown-linux-musl install directory")
+ v("qemu-armhf-rootfs", "target.arm-unknown-linux-gnueabihf.qemu-rootfs",
+ "rootfs in qemu testing, you probably don't want to use this")
+ v("qemu-aarch64-rootfs", "target.aarch64-unknown-linux-gnu.qemu-rootfs",
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index afd740ce54..428f3ad2ba 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -700,14 +700,6 @@ impl Build {
+ }
+ }
+
+- /// Returns the "musl root" for this `target`, if defined
+- fn musl_root(&self, target: Interned<String>) -> Option<&Path> {
+- self.config.target_config.get(&target)
+- .and_then(|t| t.musl_root.as_ref())
+- .or(self.config.musl_root.as_ref())
+- .map(|p| &**p)
+- }
+-
+ /// Returns whether the target will be tested using the `remote-test-client`
+ /// and `remote-test-server` binaries.
+ fn remote_tested(&self, target: Interned<String>) -> bool {
+diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
+index 5184cca653..defc85e93f 100644
+--- a/src/bootstrap/sanity.rs
++++ b/src/bootstrap/sanity.rs
+@@ -21,7 +21,7 @@
+ use std::collections::HashMap;
+ use std::env;
+ use std::ffi::{OsString, OsStr};
+-use std::fs::{self, File};
++use std::fs::File;
+ use std::io::Read;
+ use std::path::PathBuf;
+ use std::process::Command;
+@@ -169,34 +169,6 @@ pub fn check(build: &mut Build) {
+ panic!("the iOS target is only supported on macOS");
+ }
+
+- // Make sure musl-root is valid
+- if target.contains("musl") {
+- // If this is a native target (host is also musl) and no musl-root is given,
+- // fall back to the system toolchain in /usr before giving up
+- if build.musl_root(*target).is_none() && build.config.build == *target {
+- let target = build.config.target_config.entry(target.clone())
+- .or_insert(Default::default());
+- target.musl_root = Some("/usr".into());
+- }
+- match build.musl_root(*target) {
+- Some(root) => {
+- if fs::metadata(root.join("lib/libc.a")).is_err() {
+- panic!("couldn't find libc.a in musl dir: {}",
+- root.join("lib").display());
+- }
+- if fs::metadata(root.join("lib/libunwind.a")).is_err() {
+- panic!("couldn't find libunwind.a in musl dir: {}",
+- root.join("lib").display());
+- }
+- }
+- None => {
+- panic!("when targeting MUSL either the rust.musl-root \
+- option or the target.$TARGET.musl-root option must \
+- be specified in config.toml")
+- }
+- }
+- }
+-
+ if target.contains("msvc") {
+ // There are three builds of cmake on windows: MSVC, MinGW, and
+ // Cygwin. The Cygwin build does not have generators for Visual
+diff --git a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
+index 035846b4f6..5eab5933c5 100644
+--- a/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
++++ b/src/ci/docker/dist-i586-gnu-i586-i686-musl/Dockerfile
+@@ -31,8 +31,6 @@ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+ --target=i686-unknown-linux-musl,i586-unknown-linux-gnu \
+- --musl-root-i586=/musl-i586 \
+- --musl-root-i686=/musl-i686 \
+ --enable-extended
+
+ # Newer binutils broke things on some vms/distros (i.e., linking against
+diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile
+index c83f101d0a..0b9ec9de86 100644
+--- a/src/ci/docker/dist-various-1/Dockerfile
++++ b/src/ci/docker/dist-various-1/Dockerfile
+@@ -90,12 +90,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
+
+ ENV RUST_CONFIGURE_ARGS \
+ --target=$TARGETS \
+- --musl-root-arm=/musl-arm \
+- --musl-root-armhf=/musl-armhf \
+- --musl-root-armv7=/musl-armv7 \
+- --musl-root-aarch64=/musl-aarch64 \
+- --musl-root-mips=/musl-mips \
+- --musl-root-mipsel=/musl-mipsel \
+ --enable-emscripten
+
+ ENV SCRIPT python2.7 ../x.py dist --target $TARGETS
+diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile
+index c1061309c3..2fb9481479 100644
+--- a/src/ci/docker/dist-x86_64-musl/Dockerfile
++++ b/src/ci/docker/dist-x86_64-musl/Dockerfile
+@@ -31,7 +31,6 @@ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+ --target=x86_64-unknown-linux-musl \
+- --musl-root-x86_64=/musl-x86_64 \
+ --enable-extended
+
+ # Newer binutils broke things on some vms/distros (i.e., linking against
+diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs
+index 6e5e139715..d99cb55cc5 100644
+--- a/src/librustc_back/target/linux_musl_base.rs
++++ b/src/librustc_back/target/linux_musl_base.rs
+@@ -14,10 +14,6 @@ use target::TargetOptions;
+ pub fn opts() -> TargetOptions {
+ let mut base = super::linux_base::opts();
+
+- // Make sure that the linker/gcc really don't pull in anything, including
+- // default objects, libs, etc.
+- base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-nostdlib".to_string());
+-
+ // At least when this was tested, the linker would not add the
+ // `GNU_EH_FRAME` program header to executables generated, which is required
+ // when unwinding to locate the unwinding information. I'm not sure why this
+@@ -49,17 +45,6 @@ pub fn opts() -> TargetOptions {
+ base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string());
+ base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]);
+
+- // When generating a statically linked executable there's generally some
+- // small setup needed which is listed in these files. These are provided by
+- // a musl toolchain and are linked by default by the `musl-gcc` script. Note
+- // that `gcc` also does this by default, it just uses some different files.
+- //
+- // Each target directory for musl has these object files included in it so
+- // they'll be included from there.
+- base.pre_link_objects_exe.push("crt1.o".to_string());
+- base.pre_link_objects_exe.push("crti.o".to_string());
+- base.post_link_objects.push("crtn.o".to_string());
+-
+ // These targets statically link libc by default
+ base.crt_static_default = true;
+ // These targets allow the user to choose between static and dynamic linking.
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch
new file mode 100644
index 00000000..26ecebf9
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0003-Switch-musl-targets-to-link-dynamically-by-default.patch
@@ -0,0 +1,25 @@
+From b02bdc170e02f3ee226728ddd912b5d4171677d2 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Thu, 30 Nov 2017 08:15:51 -0600
+Subject: [PATCH 3/8] Switch musl targets to link dynamically by default
+
+---
+ src/librustc_back/target/linux_musl_base.rs | 2 --
+ 1 file changed, 2 deletions(-)
+
+diff --git a/src/librustc_back/target/linux_musl_base.rs b/src/librustc_back/target/linux_musl_base.rs
+index d99cb55cc5..bb786bf0f3 100644
+--- a/src/librustc_back/target/linux_musl_base.rs
++++ b/src/librustc_back/target/linux_musl_base.rs
+@@ -45,8 +45,6 @@ pub fn opts() -> TargetOptions {
+ base.pre_link_args.get_mut(&LinkerFlavor::Gcc).unwrap().push("-Wl,-(".to_string());
+ base.post_link_args.insert(LinkerFlavor::Gcc, vec!["-Wl,-)".to_string()]);
+
+- // These targets statically link libc by default
+- base.crt_static_default = true;
+ // These targets allow the user to choose between static and dynamic linking.
+ base.crt_static_respected = true;
+
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch
new file mode 100644
index 00000000..7e992b58
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0004-Prefer-libgcc_eh-over-libunwind-for-musl.patch
@@ -0,0 +1,24 @@
+From a508441f79b41f3de9bc5fd03bcc7c1fce205efb Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 9 Sep 2017 00:14:16 -0500
+Subject: [PATCH 4/8] Prefer libgcc_eh over libunwind for musl
+
+---
+ src/libunwind/lib.rs | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/libunwind/lib.rs b/src/libunwind/lib.rs
+index 5347c78121..e9be63f282 100644
+--- a/src/libunwind/lib.rs
++++ b/src/libunwind/lib.rs
+@@ -36,6 +36,6 @@ cfg_if! {
+ }
+
+ #[cfg(target_env = "musl")]
+-#[link(name = "unwind", kind = "static", cfg(target_feature = "crt-static"))]
++#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
+ #[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
+ extern {}
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch
new file mode 100644
index 00000000..ddef113e
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0005-Fix-LLVM-build.patch
@@ -0,0 +1,26 @@
+From 2dca67022c550b8ea69623fcaa04bee10112ea77 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Fri, 8 Sep 2017 00:04:29 -0500
+Subject: [PATCH 5/8] Fix LLVM build
+
+---
+ src/bootstrap/lib.rs | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
+index 428f3ad2ba..a3aaa3c57f 100644
+--- a/src/bootstrap/lib.rs
++++ b/src/bootstrap/lib.rs
+@@ -642,7 +642,8 @@ impl Build {
+ // cc-rs because the build scripts will determine that for themselves.
+ let mut base = self.cc[&target].args().iter()
+ .map(|s| s.to_string_lossy().into_owned())
+- .filter(|s| !s.starts_with("-O") && !s.starts_with("/O"))
++ .filter(|s| !s.starts_with("-O") && !s.starts_with("/O")
++ && !s.starts_with("-static"))
+ .collect::<Vec<_>>();
+
+ // If we're compiling on macOS then we add a few unconditional flags
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch
new file mode 100644
index 00000000..af86047a
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0006-Fix-rustdoc-for-cross-targets.patch
@@ -0,0 +1,36 @@
+From 7fceddea2b70f3d0e898c8be820cd2d7fb4dfc32 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 2 Dec 2017 17:25:44 -0600
+Subject: [PATCH 6/8] Fix rustdoc for cross targets
+
+musl can't handle wrong-architecture libraries in LD_LIBRARY_PATH.
+---
+ src/bootstrap/bin/rustdoc.rs | 5 +----
+ 1 file changed, 1 insertion(+), 4 deletions(-)
+
+diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
+index 389b504c64..b7b77eb431 100644
+--- a/src/bootstrap/bin/rustdoc.rs
++++ b/src/bootstrap/bin/rustdoc.rs
+@@ -34,9 +34,6 @@ fn main() {
+ Err(_) => 0,
+ };
+
+- let mut dylib_path = bootstrap::util::dylib_path();
+- dylib_path.insert(0, PathBuf::from(libdir));
+-
+ let mut cmd = Command::new(rustdoc);
+ cmd.args(&args)
+ .arg("--cfg")
+@@ -46,7 +43,7 @@ fn main() {
+ .arg("--sysroot")
+ .arg(sysroot)
+ .env(bootstrap::util::dylib_path_var(),
+- env::join_paths(&dylib_path).unwrap());
++ PathBuf::from(libdir));
+
+ // Force all crates compiled by this compiler to (a) be unstable and (b)
+ // allow the `rustc_private` feature to link to other unstable crates
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch
new file mode 100644
index 00000000..8ee65a99
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0007-Add-openssl-configuration-for-musl-targets.patch
@@ -0,0 +1,41 @@
+From 1e9d653ccb0da803b1f30ded65c2dd727c89100c Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Mon, 11 Sep 2017 11:21:56 -0500
+Subject: [PATCH 7/8] Add openssl configuration for musl targets
+
+---
+ src/bootstrap/native.rs | 7 ++++++-
+ 1 file changed, 6 insertions(+), 1 deletion(-)
+
+diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs
+index 3c91cf3ecc..198ac36789 100644
+--- a/src/bootstrap/native.rs
++++ b/src/bootstrap/native.rs
+@@ -457,8 +457,11 @@ impl Step for Openssl {
+ "arm-linux-androideabi" => "android",
+ "arm-unknown-linux-gnueabi" => "linux-armv4",
+ "arm-unknown-linux-gnueabihf" => "linux-armv4",
+- "armv7-linux-androideabi" => "android-armv7",
++ "arm-unknown-linux-musleabi" => "linux-armv4",
++ "arm-unknown-linux-musleabihf" => "linux-armv4",
++ "armv7-linux-androideabi" => "android-armv4",
+ "armv7-unknown-linux-gnueabihf" => "linux-armv4",
++ "armv7-unknown-linux-musleabihf" => "linux-armv4",
+ "i586-unknown-linux-gnu" => "linux-elf",
+ "i586-unknown-linux-musl" => "linux-elf",
+ "i686-apple-darwin" => "darwin-i386-cc",
+@@ -468,9 +471,11 @@ impl Step for Openssl {
+ "i686-unknown-linux-musl" => "linux-elf",
+ "i686-unknown-netbsd" => "BSD-x86-elf",
+ "mips-unknown-linux-gnu" => "linux-mips32",
++ "mips-unknown-linux-musl" => "linux-mips32",
+ "mips64-unknown-linux-gnuabi64" => "linux64-mips64",
+ "mips64el-unknown-linux-gnuabi64" => "linux64-mips64",
+ "mipsel-unknown-linux-gnu" => "linux-mips32",
++ "mipsel-unknown-linux-musl" => "linux-mips32",
+ "powerpc-unknown-linux-gnu" => "linux-ppc",
+ "powerpc64-unknown-linux-gnu" => "linux-ppc64",
+ "powerpc64le-unknown-linux-gnu" => "linux-ppc64le",
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
new file mode 100644
index 00000000..5a69455b
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0008-Don-t-pass-CFLAGS-to-the-C-compiler.patch
@@ -0,0 +1,36 @@
+From d1cc6048465f4cc7a06495b424693aa0c27f3137 Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Wed, 10 Jan 2018 13:36:41 -0600
+Subject: [PATCH 8/8] Don't pass CFLAGS to the C++ compiler
+
+---
+ src/bootstrap/builder.rs | 6 ++----
+ 1 file changed, 2 insertions(+), 4 deletions(-)
+
+diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
+index fcb78c479f..55848d6971 100644
+--- a/src/bootstrap/builder.rs
++++ b/src/bootstrap/builder.rs
+@@ -689,7 +689,7 @@ impl<'a> Builder<'a> {
+
+ let cflags = self.cflags(target).join(" ");
+ cargo.env(format!("CFLAGS_{}", target), cflags.clone())
+- .env("CFLAGS", cflags.clone());
++ .env("CFLAGS", cflags);
+
+ if let Some(ar) = self.ar(target) {
+ let ranlib = format!("{} s", ar.display());
+@@ -701,9 +701,7 @@ impl<'a> Builder<'a> {
+
+ if let Ok(cxx) = self.cxx(target) {
+ cargo.env(format!("CXX_{}", target), cxx)
+- .env("CXX", cxx)
+- .env(format!("CXXFLAGS_{}", target), cflags.clone())
+- .env("CXXFLAGS", cflags);
++ .env("CXX", cxx);
+ }
+ }
+
+--
+2.16.1
+
diff --git a/dev-lang/rust/files/1.25.0/0009-liblibc.patch b/dev-lang/rust/files/1.25.0/0009-liblibc.patch
new file mode 100644
index 00000000..f7867ac0
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0009-liblibc.patch
@@ -0,0 +1,17 @@
+diff --git a/src/liblibc/src/unix/mod.rs b/src/liblibc/src/unix/mod.rs
+index 134f44c5a..7e5c9b6c5 100644
+--- a/src/liblibc/src/unix/mod.rs
++++ b/src/liblibc/src/unix/mod.rs
+@@ -277,11 +277,7 @@ cfg_if! {
+ // cargo build, don't pull in anything extra as the libstd dep
+ // already pulls in all libs.
+ } else if #[cfg(target_env = "musl")] {
+- #[cfg_attr(feature = "stdbuild",
+- link(name = "c", kind = "static",
+- cfg(target_feature = "crt-static")))]
+- #[cfg_attr(feature = "stdbuild",
+- link(name = "c", cfg(not(target_feature = "crt-static"))))]
++ #[link(name = "c")]
+ extern {}
+ } else if #[cfg(target_os = "emscripten")] {
+ #[link(name = "c")]
diff --git a/dev-lang/rust/files/1.25.0/0010-llvm.patch b/dev-lang/rust/files/1.25.0/0010-llvm.patch
new file mode 100644
index 00000000..3f9f4091
--- /dev/null
+++ b/dev-lang/rust/files/1.25.0/0010-llvm.patch
@@ -0,0 +1,20 @@
+diff --git a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+index 579d23004d1..6cd9d2722fb 100644
+--- a/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
++++ b/src/llvm/include/llvm/Analysis/TargetLibraryInfo.def
+@@ -27,6 +27,15 @@
+ #define TLI_DEFINE_STRING_INTERNAL(string_repr) string_repr,
+ #endif
+
++// avoid name conflicts with musl-libc
++#undef fopen64
++#undef fseeko64
++#undef ftello64
++#undef fstat64
++#undef lstat64
++#undef stat64
++#undef tmpfile64
++
+ /// void *new(unsigned int);
+ TLI_DEFINE_ENUM_INTERNAL(msvc_new_int)
+ TLI_DEFINE_STRING_INTERNAL("??2@YAPAXI@Z")