From 0439a1358223fb39e12b39429e0b8c6a01bc8d72 Mon Sep 17 00:00:00 2001 From: q66 Date: Sun, 3 Nov 2019 18:55:56 +0100 Subject: [PATCH 1/4] rust: update to 1.39.0 This also switches to LLVM9. --- ...ative-libraries-when-linking-static-.patch | 15 ++-- ...dlib-and-musl_root-from-musl-targets.patch | 85 +++++++------------ ...er-libgcc_eh-over-libunwind-for-musl.patch | 43 +++++++++- ...piletest-Match-suffixed-environments.patch | 48 ----------- ...c-variadic-Fix-patterns-on-powerpc64.patch | 73 ---------------- ...-stage-2-tools-dynamically-to-libstd.patch | 41 ++++----- srcpkgs/rust/patches/0091-bootstrap.patch | 71 ---------------- srcpkgs/rust/patches/0099-set-piclevel.patch | 56 ++++++++++++ srcpkgs/rust/template | 9 +- 9 files changed, 154 insertions(+), 287 deletions(-) delete mode 100644 srcpkgs/rust/patches/0009-compiletest-Match-suffixed-environments.patch delete mode 100644 srcpkgs/rust/patches/0010-test-c-variadic-Fix-patterns-on-powerpc64.patch delete mode 100644 srcpkgs/rust/patches/0091-bootstrap.patch create mode 100644 srcpkgs/rust/patches/0099-set-piclevel.patch diff --git a/srcpkgs/rust/patches/0004-Require-static-native-libraries-when-linking-static-.patch b/srcpkgs/rust/patches/0004-Require-static-native-libraries-when-linking-static-.patch index 854cd61e68e..74e9e1e1b1d 100644 --- a/srcpkgs/rust/patches/0004-Require-static-native-libraries-when-linking-static-.patch +++ b/srcpkgs/rust/patches/0004-Require-static-native-libraries-when-linking-static-.patch @@ -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 - diff --git a/srcpkgs/rust/patches/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch b/srcpkgs/rust/patches/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch index 88e05b3887d..af7ed0b86c6 100644 --- a/srcpkgs/rust/patches/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch +++ b/srcpkgs/rust/patches/0005-Remove-nostdlib-and-musl_root-from-musl-targets.patch @@ -1,3 +1,5 @@ +Updated from: + From e8ef432c23ea9fb70b28bea07042b33f1050569b Mon Sep 17 00:00:00 2001 From: Samuel Holland 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, @@ -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, pub sysconfdir: Option, pub datadir: Option, -@@ -169,7 +167,6 @@ pub struct Target { +@@ -167,7 +165,6 @@ pub struct Target { pub linker: Option, pub ndk: Option, pub crt_static: Option, @@ -176,7 +160,7 @@ index 66f504ea924..5bb211501b1 100644 pub wasi_root: Option, pub qemu_rootfs: Option, pub no_std: bool, -@@ -307,7 +304,6 @@ struct Rust { +@@ -305,7 +302,6 @@ struct Rust { backtrace: Option, default_linker: Option, channel: Option, @@ -184,7 +168,7 @@ index 66f504ea924..5bb211501b1 100644 rpath: Option, optimize_tests: Option, codegen_tests: Option, -@@ -346,7 +342,6 @@ struct TomlTarget { +@@ -342,7 +338,6 @@ struct TomlTarget { linker: Option, android_ndk: Option, crt_static: Option, @@ -192,15 +176,15 @@ index 66f504ea924..5bb211501b1 100644 wasi_root: Option, qemu_rootfs: Option, } -@@ -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) -> 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 - diff --git a/srcpkgs/rust/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch b/srcpkgs/rust/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch index 2f109444886..d32841103a1 100644 --- a/srcpkgs/rust/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch +++ b/srcpkgs/rust/patches/0006-Prefer-libgcc_eh-over-libunwind-for-musl.patch @@ -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 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"); + } + } diff --git a/srcpkgs/rust/patches/0009-compiletest-Match-suffixed-environments.patch b/srcpkgs/rust/patches/0009-compiletest-Match-suffixed-environments.patch deleted file mode 100644 index 9ca4d99000c..00000000000 --- a/srcpkgs/rust/patches/0009-compiletest-Match-suffixed-environments.patch +++ /dev/null @@ -1,48 +0,0 @@ -From 0b28aa018f3f64913101495ce9806d356230856e Mon Sep 17 00:00:00 2001 -From: Samuel Holland -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 - diff --git a/srcpkgs/rust/patches/0010-test-c-variadic-Fix-patterns-on-powerpc64.patch b/srcpkgs/rust/patches/0010-test-c-variadic-Fix-patterns-on-powerpc64.patch deleted file mode 100644 index 2e2111edbbc..00000000000 --- a/srcpkgs/rust/patches/0010-test-c-variadic-Fix-patterns-on-powerpc64.patch +++ /dev/null @@ -1,73 +0,0 @@ -From e6a01c436377109808cac2d49ec30968a02b561d Mon Sep 17 00:00:00 2001 -From: Samuel Holland -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 - diff --git a/srcpkgs/rust/patches/0014-Link-stage-2-tools-dynamically-to-libstd.patch b/srcpkgs/rust/patches/0014-Link-stage-2-tools-dynamically-to-libstd.patch index 47e9173a907..632717f56bf 100644 --- a/srcpkgs/rust/patches/0014-Link-stage-2-tools-dynamically-to-libstd.patch +++ b/srcpkgs/rust/patches/0014-Link-stage-2-tools-dynamically-to-libstd.patch @@ -1,27 +1,20 @@ -From 8e160daedd1a8c928024db648c2f851cddbbd000 Mon Sep 17 00:00:00 2001 -From: Samuel Holland -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( - - // 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 +@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"); + } + + Cargo { diff --git a/srcpkgs/rust/patches/0091-bootstrap.patch b/srcpkgs/rust/patches/0091-bootstrap.patch deleted file mode 100644 index cd8c33e3f34..00000000000 --- a/srcpkgs/rust/patches/0091-bootstrap.patch +++ /dev/null @@ -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}; diff --git a/srcpkgs/rust/patches/0099-set-piclevel.patch b/srcpkgs/rust/patches/0099-set-piclevel.patch new file mode 100644 index 00000000000..5582747b1e9 --- /dev/null +++ b/srcpkgs/rust/patches/0099-set-piclevel.patch @@ -0,0 +1,56 @@ +From 194307936110470487c41637684d4b09b3516af5 Mon Sep 17 00:00:00 2001 +From: Samuel Holland +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); + } diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index 2f5e5def714..698a5853d3f 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -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 " 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 From 17e30ece9907592ae83539fdd26595d62de50ee0 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 8 Nov 2019 13:47:33 +0100 Subject: [PATCH 2/4] cargo: update to 0.40.0 --- srcpkgs/cargo/template | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/srcpkgs/cargo/template b/srcpkgs/cargo/template index 584ca07efe2..008ba9e3bde 100644 --- a/srcpkgs/cargo/template +++ b/srcpkgs/cargo/template @@ -1,6 +1,6 @@ # Template file for 'cargo' pkgname=cargo -version=0.39.0 +version=0.40.0 revision=1 wrksrc="cargo-${version}" build_helper=rust @@ -11,10 +11,11 @@ short_desc="Rust package manager" maintainer="Enno Boland " license="MIT, Apache-2.0" homepage="https://crates.io/" +_libgit2_ver=0.9.1 distfiles="https://github.com/rust-lang/cargo/archive/${version}.tar.gz - https://github.com/rust-lang/git2-rs/archive/libgit2-sys-0.8.2.tar.gz" -checksum="1fade63d5c09eab6fa234a1fdf64693ccf1b63398a316ad27edeb1f76ee4a57e - c6597bcdc2be7a2fd70c1bb8fdc75883ca5df6aea33f0354c5a8124eacc0938b" + https://github.com/rust-lang/git2-rs/archive/libgit2-sys-${_libgit2_ver}.tar.gz" +checksum="b0a6808a2eaa9b20ccaeedeb04f583ee34b33d289f4d0076044b9fc2b1f4c59d + 81e20fa9a0f6ea3e3a0e6458148f3dea4a89af87d34128d4375f2b7fd661a49c" _cargo_dist_version=0.39.0 build_options="static" @@ -79,8 +80,8 @@ post_extract() { cp ../cargo-${_cargo_dist_version}-${RUST_TARGET}/cargo/bin/cargo cargo fi - # need this for the patch to work - cp -R ${XBPS_BUILDDIR}/git2-rs-libgit2-sys-0.8.2/libgit2-sys . + mv ${XBPS_BUILDDIR}/git2-rs-libgit2-sys-${_libgit2_ver} . + mv git2-rs-libgit2-sys-${_libgit2_ver}/libgit2-sys . } post_patch() { @@ -110,6 +111,9 @@ do_build() { cargo="./cargo" fi + # gotta pin out libgit2-sys at the version + $cargo update + $cargo update --package libgit2-sys --precise ${_libgit2_ver} $cargo build --release $(vopt_if static --features="all-static") } From 5304cc09d1c8c2d7da883fe648eac22e80356f38 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 8 Nov 2019 20:59:51 +0100 Subject: [PATCH 3/4] rust: nocross for now [ci skip] --- srcpkgs/rust/template | 1 + 1 file changed, 1 insertion(+) diff --git a/srcpkgs/rust/template b/srcpkgs/rust/template index 698a5853d3f..4ee5a398d07 100644 --- a/srcpkgs/rust/template +++ b/srcpkgs/rust/template @@ -19,6 +19,7 @@ distfiles="https://static.rust-lang.org/dist/rustc-${version}-src.tar.gz" checksum=b4a1f6b6a93931f270691aba4fc85eee032fecda973e6b9c774cd06857609357 lib32disabled=yes patch_args="-Np1" +nocross=yes build_options="static_llvm" From c05781619e50718733c0c29c76a576803105e071 Mon Sep 17 00:00:00 2001 From: q66 Date: Fri, 8 Nov 2019 21:00:41 +0100 Subject: [PATCH 4/4] cargo: nocross for now [ci skip] --- srcpkgs/cargo/template | 1 + 1 file changed, 1 insertion(+) diff --git a/srcpkgs/cargo/template b/srcpkgs/cargo/template index 008ba9e3bde..123b933dee7 100644 --- a/srcpkgs/cargo/template +++ b/srcpkgs/cargo/template @@ -18,6 +18,7 @@ checksum="b0a6808a2eaa9b20ccaeedeb04f583ee34b33d289f4d0076044b9fc2b1f4c59d 81e20fa9a0f6ea3e3a0e6458148f3dea4a89af87d34128d4375f2b7fd661a49c" _cargo_dist_version=0.39.0 build_options="static" +nocross=yes if [ "$CROSS_BUILD" ]; then hostmakedepends+=" cargo"