summaryrefslogtreecommitdiff
path: root/user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
diff options
context:
space:
mode:
Diffstat (limited to 'user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch')
-rw-r--r--user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch128
1 files changed, 66 insertions, 62 deletions
diff --git a/user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
index b8ca29376..4d70e7084 100644
--- a/user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
+++ b/user/rust/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch
@@ -1,13 +1,13 @@
-From d84f9863017bd4bb38c5a2063c679dc3132ecf28 Mon Sep 17 00:00:00 2001
+From 121e89f649b1cfe3c18dc622279dc5a79873fcdb Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Fri, 8 Sep 2017 22:11:14 -0500
-Subject: [PATCH 05/14] Remove -nostdlib and musl_root from musl targets
+Subject: [PATCH 05/13] Remove -nostdlib and musl_root from musl targets
---
config.toml.example | 6 ----
- src/bootstrap/bin/rustc.rs | 12 --------
+ src/bootstrap/bin/rustc.rs | 10 -------
src/bootstrap/cc_detect.rs | 27 ++----------------
- src/bootstrap/compile.rs | 21 --------------
+ src/bootstrap/compile.rs | 21 +-------------
src/bootstrap/config.rs | 7 -----
src/bootstrap/configure.py | 22 ---------------
src/bootstrap/lib.rs | 8 ------
@@ -15,14 +15,15 @@ Subject: [PATCH 05/14] Remove -nostdlib and musl_root from musl targets
.../dist-i586-gnu-i586-i686-musl/Dockerfile | 2 --
src/ci/docker/dist-various-1/Dockerfile | 7 -----
src/ci/docker/dist-x86_64-musl/Dockerfile | 1 -
+ src/ci/docker/test-various/Dockerfile | 1 -
src/librustc_target/spec/linux_musl_base.rs | 16 -----------
- 12 files changed, 3 insertions(+), 154 deletions(-)
+ 13 files changed, 4 insertions(+), 152 deletions(-)
diff --git a/config.toml.example b/config.toml.example
-index f45db37c33..50692bf74a 100644
+index 8b2153cd2e..b8145ce8d5 100644
--- a/config.toml.example
+++ b/config.toml.example
-@@ -470,12 +470,6 @@
+@@ -474,12 +474,6 @@
# only use static libraries. If unset, the target's default linkage is used.
#crt-static = false
@@ -32,27 +33,19 @@ index f45db37c33..50692bf74a 100644
-# 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 = "..."
+ # The root location of the `wasm32-unknown-wasi` sysroot.
+ #wasi-root = "..."
+
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
-index b6afe317a0..0eace41a5a 100644
+index a76584093f..8a534ab8e2 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
-@@ -18,7 +18,6 @@
- #![deny(warnings)]
-
- use std::env;
--use std::ffi::OsString;
- use std::io;
- use std::path::PathBuf;
- use std::process::Command;
-@@ -114,17 +113,6 @@ fn main() {
+@@ -122,16 +122,6 @@ fn main() {
cmd.arg("-Cprefer-dynamic");
}
-- // Help the libc crate compile by assisting it in finding the MUSL
-- // native libraries.
+- // Help the libc crate compile by assisting it in finding various
+- // sysroot native libraries.
- if let Some(s) = env::var_os("MUSL_ROOT") {
- if target.contains("musl") {
- let mut root = OsString::from("native=");
@@ -61,10 +54,9 @@ index b6afe317a0..0eace41a5a 100644
- 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));
+ if let Some(s) = env::var_os("WASI_ROOT") {
+ let mut root = OsString::from("native=");
+ root.push(&s);
diff --git a/src/bootstrap/cc_detect.rs b/src/bootstrap/cc_detect.rs
index dfc243b705..848d1d4b2b 100644
--- a/src/bootstrap/cc_detect.rs
@@ -125,10 +117,10 @@ index dfc243b705..848d1d4b2b 100644
}
}
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
-index 249a183189..bfc62c762a 100644
+index 66443d472d..bbaa32a91c 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
-@@ -114,21 +114,6 @@ impl Step for Std {
+@@ -114,20 +114,7 @@ impl Step for Std {
fn copy_third_party_objects(builder: &Builder<'_>, compiler: &Compiler, target: Interned<String>) {
let libdir = builder.sysroot_libdir(*compiler, target);
@@ -145,29 +137,29 @@ index 249a183189..bfc62c762a 100644
- &libdir.join(obj),
- );
- }
-- }
--
- // Copies libunwind.a compiled to be linked wit x86_64-fortanix-unknown-sgx.
- //
- // This target needs to be linked to Fortanix's port of llvm's libunwind.
-@@ -182,12 +167,6 @@ pub fn std_cargo(builder: &Builder<'_>,
- cargo.arg("--features").arg(features)
+- } else if target.ends_with("-wasi") {
++ if target.ends_with("-wasi") {
+ for &obj in &["crt1.o"] {
+ builder.copy(
+ &builder.wasi_root(target).unwrap().join("lib/wasm32-wasi").join(obj),
+@@ -190,12 +177,6 @@ pub fn std_cargo(builder: &Builder<'_>,
.arg("--manifest-path")
.arg(builder.src.join("src/libstd/Cargo.toml"));
--
+
- if target.contains("musl") {
- if let Some(p) = builder.musl_root(target) {
- cargo.env("MUSL_ROOT", p);
- }
- }
- }
- }
-
+-
+ if target.ends_with("-wasi") {
+ if let Some(p) = builder.wasi_root(target) {
+ cargo.env("WASI_ROOT", p);
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
-index 7d3e584f1a..3f0113e11a 100644
+index 0c31c41ced..b8c690fc41 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
-@@ -132,8 +132,6 @@ pub struct Config {
+@@ -133,8 +133,6 @@ pub struct Config {
pub print_step_timings: bool,
pub missing_tools: bool,
@@ -176,15 +168,15 @@ index 7d3e584f1a..3f0113e11a 100644
pub prefix: Option<PathBuf>,
pub sysconfdir: Option<PathBuf>,
pub datadir: Option<PathBuf>,
-@@ -168,7 +166,6 @@ pub struct Target {
+@@ -169,7 +167,6 @@ pub struct Target {
pub linker: Option<PathBuf>,
pub ndk: Option<PathBuf>,
pub crt_static: Option<bool>,
- pub musl_root: Option<PathBuf>,
+ pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
- }
-@@ -304,7 +301,6 @@ struct Rust {
+@@ -306,7 +303,6 @@ struct Rust {
backtrace: Option<bool>,
default_linker: Option<String>,
channel: Option<String>,
@@ -192,15 +184,15 @@ index 7d3e584f1a..3f0113e11a 100644
rpath: Option<bool>,
optimize_tests: Option<bool>,
debuginfo_tests: Option<bool>,
-@@ -343,7 +339,6 @@ struct TomlTarget {
+@@ -346,7 +342,6 @@ struct TomlTarget {
linker: Option<String>,
android_ndk: Option<String>,
crt_static: Option<bool>,
- musl_root: Option<String>,
+ wasi_root: Option<String>,
qemu_rootfs: Option<String>,
}
-
-@@ -562,7 +557,6 @@ impl Config {
+@@ -566,7 +561,6 @@ impl Config {
set(&mut config.llvm_tools_enabled, rust.llvm_tools);
config.rustc_parallel = rust.parallel_compiler.unwrap_or(false);
config.rustc_default_linker = rust.default_linker.clone();
@@ -208,19 +200,19 @@ index 7d3e584f1a..3f0113e11a 100644
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
-@@ -605,7 +599,6 @@ impl Config {
+@@ -609,7 +603,6 @@ impl Config {
target.ranlib = cfg.ranlib.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.wasi_root = cfg.wasi_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 b2d8f2d8eb..c3bb94938f 100755
+index ade8afee7c..f9ccf7aed5 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
-@@ -109,28 +109,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
+@@ -111,28 +111,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")
@@ -250,10 +242,10 @@ index b2d8f2d8eb..c3bb94938f 100755
"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 f1e7f05aa9..4ee1444db3 100644
+index 71ca61d97e..3b53029a79 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
-@@ -842,14 +842,6 @@ impl Build {
+@@ -861,14 +861,6 @@ impl Build {
}
}
@@ -265,14 +257,14 @@ index f1e7f05aa9..4ee1444db3 100644
- .map(|p| &**p)
- }
-
- /// Returns `true` if this is a no-std `target`, if defined
- fn no_std(&self, target: Interned<String>) -> Option<bool> {
+ /// Returns the sysroot for the wasi target, if defined
+ fn wasi_root(&self, target: Interned<String>) -> Option<&Path> {
self.config.target_config.get(&target)
diff --git a/src/bootstrap/sanity.rs b/src/bootstrap/sanity.rs
-index ff4fb85bbf..ff45200bde 100644
+index b9f456e910..792c975333 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
-@@ -169,34 +169,6 @@ pub fn check(build: &mut Build) {
+@@ -171,34 +171,6 @@ pub fn check(build: &mut Build) {
}
}
@@ -321,10 +313,10 @@ index ba2d32a929..412c37fdd1 100644
--disable-docs
diff --git a/src/ci/docker/dist-various-1/Dockerfile b/src/ci/docker/dist-various-1/Dockerfile
-index f80293b182..52f28df826 100644
+index a722a41839..44e6728de7 100644
--- a/src/ci/docker/dist-various-1/Dockerfile
+++ b/src/ci/docker/dist-various-1/Dockerfile
-@@ -130,13 +130,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
+@@ -132,13 +132,6 @@ ENV CC_mipsel_unknown_linux_musl=mipsel-openwrt-linux-gcc \
CXX_thumbv7neon_unknown_linux_gnueabihf=arm-linux-gnueabihf-g++
ENV RUST_CONFIGURE_ARGS \
@@ -339,17 +331,29 @@ index f80293b182..52f28df826 100644
--disable-docs
diff --git a/src/ci/docker/dist-x86_64-musl/Dockerfile b/src/ci/docker/dist-x86_64-musl/Dockerfile
-index 06f8a2fbba..f5dd379528 100644
+index 21a9023a45..db7c9729d0 100644
--- a/src/ci/docker/dist-x86_64-musl/Dockerfile
+++ b/src/ci/docker/dist-x86_64-musl/Dockerfile
-@@ -30,7 +30,6 @@ COPY scripts/sccache.sh /scripts/
+@@ -29,7 +29,6 @@ COPY scripts/sccache.sh /scripts/
RUN sh /scripts/sccache.sh
ENV RUST_CONFIGURE_ARGS \
-- --musl-root-x86_64=/musl-x86_64 \
+- --musl-root-x86_64=/usr/local/x86_64-linux-musl \
--enable-extended \
--disable-docs
+diff --git a/src/ci/docker/test-various/Dockerfile b/src/ci/docker/test-various/Dockerfile
+index 611a24a69b..99c2b866b1 100644
+--- a/src/ci/docker/test-various/Dockerfile
++++ b/src/ci/docker/test-various/Dockerfile
+@@ -31,7 +31,6 @@ COPY scripts/sccache.sh /scripts/
+ RUN sh /scripts/sccache.sh
+
+ ENV RUST_CONFIGURE_ARGS \
+- --musl-root-x86_64=/usr/local/x86_64-linux-musl \
+ --set build.nodejs=/node-v9.2.0-linux-x64/bin/node \
+ --set rust.lld
+
diff --git a/src/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs
index e294e63982..58ae91a96a 100644
--- a/src/librustc_target/spec/linux_musl_base.rs