rust: update to 1.39.0

This also switches to LLVM9.
This commit is contained in:
q66 2019-11-03 18:55:56 +01:00 committed by Helmut Pozimski
parent c3a51a0b4a
commit d94f88a684
9 changed files with 154 additions and 287 deletions

View file

@ -19,7 +19,7 @@ diff --git a/src/librustc_codegen_ssa/back/link.rs b/src/librustc_codegen_ssa/ba
index e3d297e7862..974e8c0239b 100644
--- a/src/librustc_codegen_ssa/back/link.rs
+++ b/src/librustc_codegen_ssa/back/link.rs
@@ -1571,9 +1571,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
@@ -1602,9 +1602,7 @@ fn add_upstream_rust_crates<'a, B: ArchiveBuilder<'a>>(cmd: &mut dyn Linker,
}
}
@ -30,11 +30,11 @@ index e3d297e7862..974e8c0239b 100644
//
// 1. The upstream crate is an rlib. In this case we *must* link in the
// native dependency because the rlib is just an archive.
@@ -1616,7 +1614,19 @@ pub fn add_upstream_native_libraries(cmd: &mut dyn Linker,
@@ -1647,7 +1645,19 @@ pub fn add_upstream_native_libraries(cmd: &mut dyn Linker,
continue
}
match lib.kind {
- NativeLibraryKind::NativeUnknown => cmd.link_dylib(&name.as_str()),
- NativeLibraryKind::NativeUnknown => cmd.link_dylib(name),
+ NativeLibraryKind::NativeUnknown => {
+ // On some targets, like Linux, linking a static executable inhibits using
+ // dylibs at all. Force native libraries to be static, even if for example
@ -43,14 +43,11 @@ index e3d297e7862..974e8c0239b 100644
+ && sess.crt_static()
+ && !sess.target.target.options.crt_static_allows_dylibs
+ {
+ cmd.link_staticlib(&name.as_str())
+ cmd.link_staticlib(name)
+ } else {
+ cmd.link_dylib(&name.as_str())
+ cmd.link_dylib(name)
+ }
+ },
NativeLibraryKind::NativeFramework => cmd.link_framework(&name.as_str()),
NativeLibraryKind::NativeFramework => cmd.link_framework(name),
NativeLibraryKind::NativeStaticNobundle => {
// Link "static-nobundle" native libs only if the crate they originate from
--
2.21.0

View file

@ -1,3 +1,5 @@
Updated from:
From e8ef432c23ea9fb70b28bea07042b33f1050569b Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Fri, 8 Sep 2017 22:11:14 -0500
@ -20,10 +22,10 @@ Subject: [PATCH 05/16] Remove -nostdlib and musl_root from musl targets
13 files changed, 4 insertions(+), 152 deletions(-)
diff --git a/config.toml.example b/config.toml.example
index c14adf8ce33..8ec8d2bbbb7 100644
index 848147c2..2aea23d4 100644
--- a/config.toml.example
+++ b/config.toml.example
@@ -479,12 +479,6 @@
@@ -469,12 +469,6 @@
# only use static libraries. If unset, the target's default linkage is used.
#crt-static = false
@ -36,32 +38,11 @@ index c14adf8ce33..8ec8d2bbbb7 100644
# The root location of the `wasm32-wasi` sysroot.
#wasi-root = "..."
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 595deb07ec8..c077dc1581e 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -145,16 +145,6 @@ fn main() {
cmd.arg("-Cprefer-dynamic");
}
- // 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=");
- root.push(&s);
- root.push("/lib");
- cmd.arg("-L").arg(&root);
- }
- }
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 400375cd201..0394ab7a8a7 100644
index a4cb81d3..b4247e74 100644
--- a/src/bootstrap/cc_detect.rs
+++ b/src/bootstrap/cc_detect.rs
@@ -84,7 +84,7 @@ pub fn find(build: &mut Build) {
@@ -86,7 +86,7 @@ pub fn find(build: &mut Build) {
if let Some(cc) = config.and_then(|c| c.cc.as_ref()) {
cfg.compiler(cc);
} else {
@ -70,7 +51,7 @@ index 400375cd201..0394ab7a8a7 100644
}
let compiler = cfg.get_compiler();
@@ -107,7 +107,7 @@ pub fn find(build: &mut Build) {
@@ -109,7 +109,7 @@ pub fn find(build: &mut Build) {
cfg.compiler(cxx);
true
} else if build.hosts.contains(&target) || build.build == target {
@ -79,7 +60,7 @@ index 400375cd201..0394ab7a8a7 100644
true
} else {
false
@@ -134,8 +134,7 @@ pub fn find(build: &mut Build) {
@@ -136,8 +136,7 @@ pub fn find(build: &mut Build) {
fn set_compiler(cfg: &mut cc::Build,
compiler: Language,
target: Interned<String>,
@ -89,7 +70,7 @@ index 400375cd201..0394ab7a8a7 100644
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
@@ -175,26 +174,6 @@ fn set_compiler(cfg: &mut cc::Build,
@@ -177,26 +176,6 @@ fn set_compiler(cfg: &mut cc::Build,
}
}
@ -117,7 +98,7 @@ index 400375cd201..0394ab7a8a7 100644
}
}
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 576267e6948..8e5de3907f6 100644
index 6ea32edf..afdf6fcf 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -116,20 +116,7 @@ impl Step for Std {
@ -142,24 +123,27 @@ index 576267e6948..8e5de3907f6 100644
for &obj in &["crt1.o"] {
builder.copy(
&builder.wasi_root(target).unwrap().join("lib/wasm32-wasi").join(obj),
@@ -219,12 +206,6 @@ pub fn std_cargo(builder: &Builder<'_>,
@@ -220,15 +207,6 @@ pub fn std_cargo(builder: &Builder<'_>,
.arg("--manifest-path")
.arg(builder.src.join("src/libstd/Cargo.toml"));
.arg(builder.src.join("src/libtest/Cargo.toml"));
- // Help the libc crate compile by assisting it in finding various
- // sysroot native libraries.
- if target.contains("musl") {
- if let Some(p) = builder.musl_root(target) {
- cargo.env("MUSL_ROOT", p);
- let root = format!("native={}/lib", p.to_str().unwrap());
- cargo.rustflag("-L").rustflag(&root);
- }
- }
-
if target.ends_with("-wasi") {
if let Some(p) = builder.wasi_root(target) {
cargo.env("WASI_ROOT", p);
let root = format!("native={}/lib/wasm32-wasi", p.to_str().unwrap());
diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs
index 66f504ea924..5bb211501b1 100644
index 52b5cd88..cc191271 100644
--- a/src/bootstrap/config.rs
+++ b/src/bootstrap/config.rs
@@ -133,8 +133,6 @@ pub struct Config {
@@ -131,8 +131,6 @@ pub struct Config {
pub print_step_timings: bool,
pub missing_tools: bool,
@ -168,7 +152,7 @@ index 66f504ea924..5bb211501b1 100644
pub prefix: Option<PathBuf>,
pub sysconfdir: Option<PathBuf>,
pub datadir: Option<PathBuf>,
@@ -169,7 +167,6 @@ pub struct Target {
@@ -167,7 +165,6 @@ pub struct Target {
pub linker: Option<PathBuf>,
pub ndk: Option<PathBuf>,
pub crt_static: Option<bool>,
@ -176,7 +160,7 @@ index 66f504ea924..5bb211501b1 100644
pub wasi_root: Option<PathBuf>,
pub qemu_rootfs: Option<PathBuf>,
pub no_std: bool,
@@ -307,7 +304,6 @@ struct Rust {
@@ -305,7 +302,6 @@ struct Rust {
backtrace: Option<bool>,
default_linker: Option<String>,
channel: Option<String>,
@ -184,7 +168,7 @@ index 66f504ea924..5bb211501b1 100644
rpath: Option<bool>,
optimize_tests: Option<bool>,
codegen_tests: Option<bool>,
@@ -346,7 +342,6 @@ struct TomlTarget {
@@ -342,7 +338,6 @@ struct TomlTarget {
linker: Option<String>,
android_ndk: Option<String>,
crt_static: Option<bool>,
@ -192,15 +176,15 @@ index 66f504ea924..5bb211501b1 100644
wasi_root: Option<String>,
qemu_rootfs: Option<String>,
}
@@ -569,7 +564,6 @@ impl Config {
@@ -562,7 +557,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();
- config.musl_root = rust.musl_root.clone().map(PathBuf::from);
config.save_toolstates = rust.save_toolstates.clone().map(PathBuf::from);
set(&mut config.deny_warnings, rust.deny_warnings.or(flags.warnings));
set(&mut config.deny_warnings, flags.deny_warnings.or(rust.deny_warnings));
set(&mut config.backtrace_on_ice, rust.backtrace_on_ice);
@@ -607,7 +601,6 @@ impl Config {
@@ -600,7 +594,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();
@ -209,7 +193,7 @@ index 66f504ea924..5bb211501b1 100644
target.qemu_rootfs = cfg.qemu_rootfs.clone().map(PathBuf::from);
diff --git a/src/bootstrap/configure.py b/src/bootstrap/configure.py
index 907983d43ad..e91f6fcbe4b 100755
index 346f0cb2..80409781 100755
--- a/src/bootstrap/configure.py
+++ b/src/bootstrap/configure.py
@@ -110,30 +110,6 @@ v("aarch64-linux-android-ndk", "target.aarch64-linux-android.android-ndk",
@ -244,10 +228,10 @@ index 907983d43ad..e91f6fcbe4b 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 867df81d972..4fb57aa6db6 100644
index d292609f..ff5f7e16 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -847,14 +847,6 @@ impl Build {
@@ -835,14 +835,6 @@ impl Build {
}
}
@ -263,10 +247,10 @@ index 867df81d972..4fb57aa6db6 100644
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 dc65fb9b797..060ba6d9e42 100644
index bffe748f..3b109548 100644
--- a/src/bootstrap/sanity.rs
+++ b/src/bootstrap/sanity.rs
@@ -176,34 +176,6 @@ pub fn check(build: &mut Build) {
@@ -187,30 +187,6 @@ pub fn check(build: &mut Build) {
}
}
@ -285,10 +269,6 @@ index dc65fb9b797..060ba6d9e42 100644
- 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 \
@ -302,7 +282,7 @@ index dc65fb9b797..060ba6d9e42 100644
// 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/librustc_target/spec/linux_musl_base.rs b/src/librustc_target/spec/linux_musl_base.rs
index e294e63982d..58ae91a96aa 100644
index 17fecb3b..18732066 100644
--- a/src/librustc_target/spec/linux_musl_base.rs
+++ b/src/librustc_target/spec/linux_musl_base.rs
@@ -3,28 +3,12 @@ use crate::spec::{LinkerFlavor, TargetOptions};
@ -334,6 +314,3 @@ index e294e63982d..58ae91a96aa 100644
// 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.21.0

View file

@ -1,3 +1,5 @@
Additions for build.rs by q66, necessary for our musl setup.
From 1eb558f246269606c6d8d73824ef6b44fa10764e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sat, 9 Sep 2017 00:14:16 -0500
@ -19,6 +21,41 @@ index 9182e349b19..0377fbb58fc 100644
+#[link(name = "gcc_eh", cfg(target_feature = "crt-static"))]
#[link(name = "gcc_s", cfg(not(target_feature = "crt-static")))]
extern {}
--
2.21.0
diff --git a/src/libunwind/build.rs b/src/libunwind/build.rs
index f24d957..28828e5 100644
--- a/src/libunwind/build.rs
+++ b/src/libunwind/build.rs
@@ -5,15 +5,11 @@ fn main() {
let target = env::var("TARGET").expect("TARGET was not set");
if cfg!(feature = "llvm-libunwind") &&
- ((target.contains("linux") && !target.contains("musl")) ||
- target.contains("fuchsia")) {
+ (target.contains("linux") || target.contains("fuchsia")) {
// Build the unwinding from libunwind C/C++ source code.
llvm_libunwind::compile();
} else if target.contains("linux") {
- if target.contains("musl") {
- // linking for musl is handled in lib.rs
- llvm_libunwind::compile();
- } else if !target.contains("android") {
+ if !target.contains("android") {
println!("cargo:rustc-link-lib=gcc_s");
}
} else if target.contains("freebsd") {
@@ -99,15 +95,6 @@ mod llvm_libunwind {
cfg.file(root.join("src").join(src));
}
- if target_env == "musl" {
- // use the same C compiler command to compile C++ code so we do not need to setup the
- // C++ compiler env variables on the builders
- cfg.cpp(false);
- // linking for musl is handled in lib.rs
- cfg.cargo_metadata(false);
- println!("cargo:rustc-link-search=native={}", env::var("OUT_DIR").unwrap());
- }
-
cfg.compile("unwind");
}
}

View file

@ -1,48 +0,0 @@
From 0b28aa018f3f64913101495ce9806d356230856e Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Mon, 2 Sep 2019 22:10:10 -0500
Subject: [PATCH 09/16] compiletest: Match suffixed environments
---
src/tools/compiletest/src/header.rs | 2 +-
src/tools/compiletest/src/util.rs | 8 ++++++--
2 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 52f777db2da..4bf3c1a8527 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -820,10 +820,10 @@ impl Config {
if name == "test" ||
util::matches_os(&self.target, name) || // target
+ util::matches_env(&self.target, name) || // env
name == util::get_arch(&self.target) || // architecture
name == util::get_pointer_width(&self.target) || // pointer width
name == self.stage_id.split('-').next().unwrap() || // stage
- Some(name) == util::get_env(&self.target) || // env
(self.target != self.host && name == "cross-compile") ||
match self.compare_mode {
Some(CompareMode::Nll) => name == "compare-mode-nll",
diff --git a/src/tools/compiletest/src/util.rs b/src/tools/compiletest/src/util.rs
index 8caf5ca00f5..d23f4edc55d 100644
--- a/src/tools/compiletest/src/util.rs
+++ b/src/tools/compiletest/src/util.rs
@@ -101,8 +101,12 @@ pub fn get_arch(triple: &str) -> &'static str {
panic!("Cannot determine Architecture from triple");
}
-pub fn get_env(triple: &str) -> Option<&str> {
- triple.split('-').nth(3)
+pub fn matches_env(triple: &str, name: &str) -> bool {
+ if let Some(env) = triple.split('-').nth(3) {
+ env.starts_with(name)
+ } else {
+ false
+ }
}
pub fn get_pointer_width(triple: &str) -> &'static str {
--
2.21.0

View file

@ -1,73 +0,0 @@
From e6a01c436377109808cac2d49ec30968a02b561d Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Mon, 2 Sep 2019 22:09:15 -0500
Subject: [PATCH 10/16] test/c-variadic: Fix patterns on powerpc64
---
src/test/codegen/c-variadic.rs | 22 +++++++++++-----------
1 file changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/test/codegen/c-variadic.rs b/src/test/codegen/c-variadic.rs
index bb90a9653f5..6ef77ca483f 100644
--- a/src/test/codegen/c-variadic.rs
+++ b/src/test/codegen/c-variadic.rs
@@ -14,13 +14,13 @@ extern "C" {
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_0() {
// Ensure that we correctly call foreign C-variadic functions.
- // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0)
+ // CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM:i32( signext)?]] 0)
foreign_c_variadic_0(0);
- // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42)
+ // CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42)
foreign_c_variadic_0(0, 42i32);
- // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024)
+ // CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024)
foreign_c_variadic_0(0, 42i32, 1024i32);
- // CHECK: invoke void (i32, ...) @foreign_c_variadic_0(i32 0, i32 42, i32 1024, i32 0)
+ // CHECK: invoke void (i32, ...) @foreign_c_variadic_0([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024, [[PARAM]] 0)
foreign_c_variadic_0(0, 42i32, 1024i32, 0i32);
}
@@ -34,18 +34,18 @@ pub unsafe extern "C" fn use_foreign_c_variadic_1_0(ap: VaList) {
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_1(ap: VaList) {
- // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 42)
+ // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 42)
foreign_c_variadic_1(ap, 42i32);
}
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_2(ap: VaList) {
- // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42)
+ // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42)
foreign_c_variadic_1(ap, 2i32, 42i32);
}
#[unwind(aborts)] // FIXME(#58794)
pub unsafe extern "C" fn use_foreign_c_variadic_1_3(ap: VaList) {
- // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, i32 2, i32 42, i32 0)
+ // CHECK: invoke void ({{.*}}*, ...) @foreign_c_variadic_1({{.*}} %ap, [[PARAM]] 2, [[PARAM]] 42, [[PARAM]] 0)
foreign_c_variadic_1(ap, 2i32, 42i32, 0i32);
}
@@ -64,12 +64,12 @@ pub unsafe extern "C" fn c_variadic(n: i32, mut ap: ...) -> i32 {
// Ensure that we generate the correct `call` signature when calling a Rust
// defined C-variadic.
pub unsafe fn test_c_variadic_call() {
- // CHECK: call i32 (i32, ...) @c_variadic(i32 0)
+ // CHECK: call [[RET:(signext )?i32]] (i32, ...) @c_variadic([[PARAM]] 0)
c_variadic(0);
- // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42)
+ // CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42)
c_variadic(0, 42i32);
- // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024)
+ // CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024)
c_variadic(0, 42i32, 1024i32);
- // CHECK: call i32 (i32, ...) @c_variadic(i32 0, i32 42, i32 1024, i32 0)
+ // CHECK: call [[RET]] (i32, ...) @c_variadic([[PARAM]] 0, [[PARAM]] 42, [[PARAM]] 1024, [[PARAM]] 0)
c_variadic(0, 42i32, 1024i32, 0i32);
}
--
2.21.0

View file

@ -1,27 +1,20 @@
From 8e160daedd1a8c928024db648c2f851cddbbd000 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Mon, 24 Sep 2018 23:42:23 +0000
Subject: [PATCH 14/16] Link stage 2 tools dynamically to libstd
Replaces an older patch by Samuel Holland. The RUSTC_NO_PREFER_DYNAMIC
env var was removed and replaced with the following logic in builder.rs.
---
src/bootstrap/tool.rs | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
The idea for this patch is to link stage2 tools dynamically as these will
be distributed (if built). Intermediate tools from previous stages will
be statically linked for convenience.
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index bd77f7a91d9..70477b44032 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -210,7 +210,9 @@ pub fn prepare_tool_cargo(
@q66
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -1228,6 +1228,8 @@ impl<'a> Builder<'a> {
// linking all deps statically into the dylib.
if let Mode::Std | Mode::Rustc | Mode::Codegen = mode {
rustflags.arg("-Cprefer-dynamic");
+ } else if stage >= 2 {
+ rustflags.arg("-Cprefer-dynamic");
}
// We don't want to build tools dynamically as they'll be running across
// stages and such and it's just easier if they're not dynamically linked.
- cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
+ if compiler.stage < 2 {
+ cargo.env("RUSTC_NO_PREFER_DYNAMIC", "1");
+ }
if source_type == SourceType::Submodule {
cargo.env("RUSTC_EXTERNAL_TOOL", "1");
--
2.21.0
Cargo {

View file

@ -1,71 +0,0 @@
Rust 1.38 can't bootstrap itself. It has some ridiculous warnings enabled
by default which break this (even though the compiler obviously needs to
be able to compile itself just fine, that's what stage1 is all about).
diff --git a/src/bootstrap/bin/main.rs b/src/bootstrap/bin/main.rs
index bd1a87c..138b7f4 100644
--- a/src/bootstrap/bin/main.rs
+++ b/src/bootstrap/bin/main.rs
@@ -5,9 +5,6 @@
//! parent directory, and otherwise documentation can be found throughout the `build`
//! directory in each respective module.
-// NO-RUSTC-WRAPPER
-#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
-
use std::env;
use bootstrap::{Config, Build};
diff --git a/src/bootstrap/bin/rustc.rs b/src/bootstrap/bin/rustc.rs
index 81e7e46..d3d84ca 100644
--- a/src/bootstrap/bin/rustc.rs
+++ b/src/bootstrap/bin/rustc.rs
@@ -15,9 +15,6 @@
//! switching compilers for the bootstrap and for build scripts will probably
//! never get replaced.
-// NO-RUSTC-WRAPPER
-#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
-
use std::env;
use std::ffi::OsString;
use std::io;
diff --git a/src/bootstrap/bin/rustdoc.rs b/src/bootstrap/bin/rustdoc.rs
index 184c9b1..2a8397a 100644
--- a/src/bootstrap/bin/rustdoc.rs
+++ b/src/bootstrap/bin/rustdoc.rs
@@ -2,9 +2,6 @@
//!
//! See comments in `src/bootstrap/rustc.rs` for more information.
-// NO-RUSTC-WRAPPER
-#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
-
use std::env;
use std::process::Command;
use std::path::PathBuf;
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 76cc0dd..5eeed7c 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -103,9 +103,6 @@
//! More documentation can be found in each respective module below, and you can
//! also check out the `src/bootstrap/README.md` file for more information.
-// NO-RUSTC-WRAPPER
-#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
-
#![feature(core_intrinsics)]
#![feature(drain_filter)]
diff --git a/src/build_helper/lib.rs b/src/build_helper/lib.rs
index a1aa189..f3f5913 100644
--- a/src/build_helper/lib.rs
+++ b/src/build_helper/lib.rs
@@ -1,6 +1,3 @@
-// NO-RUSTC-WRAPPER
-#![deny(warnings, rust_2018_idioms, unused_lifetimes)]
-
use std::fs::File;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};

View file

@ -0,0 +1,56 @@
From 194307936110470487c41637684d4b09b3516af5 Mon Sep 17 00:00:00 2001
From: Samuel Holland <samuel@sholland.org>
Date: Sun, 3 Nov 2019 10:52:00 -0600
Subject: [PATCH] Configure LLVM module PIC level
As of LLVM 9, this is required for 32-bit PowerPC to properly generate
PLT references. Previously, only BigPIC was supported; now LLVM supports
both BigPIC and SmallPIC, and there is no default value provided.
---
src/librustc_codegen_llvm/context.rs | 4 ++++
src/librustc_codegen_llvm/llvm/ffi.rs | 1 +
src/rustllvm/PassWrapper.cpp | 4 ++++
3 files changed, 9 insertions(+)
diff --git a/src/librustc_codegen_llvm/context.rs b/src/librustc_codegen_llvm/context.rs
index 2da938771721..4a40349cb73e 100644
--- a/src/librustc_codegen_llvm/context.rs
+++ b/src/librustc_codegen_llvm/context.rs
@@ -203,6 +203,10 @@ pub unsafe fn create_module(
let llvm_target = SmallCStr::new(&sess.target.target.llvm_target);
llvm::LLVMRustSetNormalizedTarget(llmod, llvm_target.as_ptr());
+ if get_reloc_model(sess) == llvm::RelocMode::PIC {
+ llvm::LLVMRustSetModulePICLevel(llmod);
+ }
+
if is_pie_binary(sess) {
llvm::LLVMRustSetModulePIELevel(llmod);
}
diff --git a/src/librustc_codegen_llvm/llvm/ffi.rs b/src/librustc_codegen_llvm/llvm/ffi.rs
index c69942ef3f2d..7f7b5b22d9af 100644
--- a/src/librustc_codegen_llvm/llvm/ffi.rs
+++ b/src/librustc_codegen_llvm/llvm/ffi.rs
@@ -1805,6 +1805,7 @@ extern "C" {
pub fn LLVMRustSetComdat(M: &'a Module, V: &'a Value, Name: *const c_char);
pub fn LLVMRustUnsetComdat(V: &Value);
+ pub fn LLVMRustSetModulePICLevel(M: &Module);
pub fn LLVMRustSetModulePIELevel(M: &Module);
pub fn LLVMRustModuleBufferCreate(M: &Module) -> &'static mut ModuleBuffer;
pub fn LLVMRustModuleBufferPtr(p: &ModuleBuffer) -> *const u8;
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 0cda3465dc09..4c5bc20b86db 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -754,6 +754,10 @@ LLVMRustSetDataLayoutFromTargetMachine(LLVMModuleRef Module,
unwrap(Module)->setDataLayout(Target->createDataLayout());
}
+extern "C" void LLVMRustSetModulePICLevel(LLVMModuleRef M) {
+ unwrap(M)->setPICLevel(PICLevel::Level::BigPIC);
+}
+
extern "C" void LLVMRustSetModulePIELevel(LLVMModuleRef M) {
unwrap(M)->setPIELevel(PIELevel::Level::Large);
}

View file

@ -1,7 +1,7 @@
# Template file for 'rust'
# partially adapted from Alpine/Adélie's Rust APKBUILD
pkgname=rust
version=1.38.0
version=1.39.0
revision=1
_rust_dist_version=1.38.0
_cargo_dist_version=0.39.0
@ -9,15 +9,14 @@ _cargo_dist_version=0.39.0
# uploaded to https://alpha.de.repo.voidlinux.org/distfiles/
wrksrc="rustc-${version}-src"
hostmakedepends="cmake curl pkg-config python3"
# using llvm9 results in broken executables for some targets
makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm8"
makedepends="libffi-devel ncurses-devel libxml2-devel zlib-devel llvm"
depends="rust-std"
short_desc="Safe, concurrent, practical systems language"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT, Apache-2.0"
homepage="https://www.rust-lang.org/"
distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz"
checksum=644263ca7c7106f8ee8fcde6bb16910d246b30668a74be20b8c7e0e9f4a52d80
checksum=b4a1f6b6a93931f270691aba4fc85eee032fecda973e6b9c774cd06857609357
lib32disabled=yes
patch_args="-Np1"
@ -26,7 +25,7 @@ build_options="static_llvm"
_bootstrap_dir="stage0-bootstrap"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" cargo llvm8"
hostmakedepends+=" cargo llvm"
# These are required for building the buildhost's stage0/1
hostmakedepends+=" libffi-devel libxml2-devel ncurses-devel zlib-devel"
else