Merge pull request #2 from import/rust:rosa2019.1

Backports 1.43.0
This commit is contained in:
djam 2020-05-04 07:37:25 +00:00
commit 4e1f743a83
8 changed files with 593 additions and 186 deletions

View file

@ -1,4 +1,5 @@
sources:
rust-1.30.0-i686-unknown-linux-gnu.tar.xz: da90ccc0a4f16ea4db8f87fc0a862744f2ac30df
rust-1.30.0-x86_64-unknown-linux-gnu.tar.xz: 12901cf47732ad13ccc3fbea0aba853544644676
rustc-1.31.0-src.tar.xz: 79878ca48506ee7d17cd8375fca5f9950699c097
rust-1.42.0-aarch64-unknown-linux-gnu.tar.xz: 985d3b7d2a2ebcd09415f2d2702d8b18b9d038f1
rust-1.42.0-i686-unknown-linux-gnu.tar.xz: 3b740f05be16327820b64f4b4ff9ec3d0f005e54
rust-1.42.0-x86_64-unknown-linux-gnu.tar.xz: ebb8fe2ac0459229f8aa89e153e831bd2d506018
rustc-1.43.0-src.tar.xz: 685cb48f76a47cda65d0a0c1da85bfe61e1a8cc0

View file

@ -1,118 +0,0 @@
From f107514aef0b25b0d959941df1e45b18a478151b Mon Sep 17 00:00:00 2001
From: Josh Stone <jistone@redhat.com>
Date: Fri, 30 Nov 2018 15:33:40 -0800
Subject: [PATCH] Deal with EINTR in net timeout tests
We've seen sporadic QE failures in the timeout tests on this assertion:
assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
So there's an error, but not either of the expected kinds. Adding a
format to show the kind revealed `ErrorKind::Interrupted` (`EINTR`).
For the cases that were using `read`, we can just use `read_exact` to
keep trying after interruption. For those using `recv_from`, we have to
manually loop until we get a non-interrupted result.
---
src/libstd/net/tcp.rs | 10 ++++++----
src/libstd/net/udp.rs | 20 ++++++++++++++++----
src/libstd/sys/unix/ext/net.rs | 10 ++++++----
3 files changed, 28 insertions(+), 12 deletions(-)
diff --git a/src/libstd/net/tcp.rs b/src/libstd/net/tcp.rs
index ad212a547579..be797803233a 100644
--- a/src/libstd/net/tcp.rs
+++ b/src/libstd/net/tcp.rs
@@ -1548,8 +1548,9 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
@@ -1570,8 +1571,9 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
assert!(start.elapsed() > Duration::from_millis(400));
drop(listener);
}
diff --git a/src/libstd/net/udp.rs b/src/libstd/net/udp.rs
index 0ebe3284b4f0..fc68abae05a0 100644
--- a/src/libstd/net/udp.rs
+++ b/src/libstd/net/udp.rs
@@ -1030,8 +1030,14 @@ mod tests {
let mut buf = [0; 10];
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
@@ -1049,8 +1055,14 @@ mod tests {
assert_eq!(b"hello world", &buf[..]);
let start = Instant::now();
- let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
- assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut);
+ loop {
+ let kind = stream.recv_from(&mut buf).err().expect("expected error").kind();
+ if kind != ErrorKind::Interrupted {
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
+ break;
+ }
+ }
assert!(start.elapsed() > Duration::from_millis(400));
}
diff --git a/src/libstd/sys/unix/ext/net.rs b/src/libstd/sys/unix/ext/net.rs
index 55f43ccd7db4..737437c76b7c 100644
--- a/src/libstd/sys/unix/ext/net.rs
+++ b/src/libstd/sys/unix/ext/net.rs
@@ -1654,8 +1654,9 @@ mod test {
or_panic!(stream.set_read_timeout(Some(Duration::from_millis(1000))));
let mut buf = [0; 10];
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
#[test]
@@ -1675,8 +1676,9 @@ mod test {
or_panic!(stream.read(&mut buf));
assert_eq!(b"hello world", &buf[..]);
- let kind = stream.read(&mut buf).err().expect("expected error").kind();
- assert!(kind == io::ErrorKind::WouldBlock || kind == io::ErrorKind::TimedOut);
+ let kind = stream.read_exact(&mut buf).err().expect("expected error").kind();
+ assert!(kind == ErrorKind::WouldBlock || kind == ErrorKind::TimedOut,
+ "unexpected_error: {:?}", kind);
}
// Ensure the `set_read_timeout` and `set_write_timeout` calls return errors
--
2.19.1

View file

@ -0,0 +1,25 @@
From 31dcdc9e13c324d33a18db3aed7f4b3208ff3744 Mon Sep 17 00:00:00 2001
From: Mark Rousskov <mark.simulacrum@gmail.com>
Date: Fri, 31 Jan 2020 12:30:17 -0500
Subject: [PATCH] Drop cfg(bootstrap) code
---
src/bootstrap/lib.rs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/bootstrap/lib.rs b/src/bootstrap/lib.rs
index 1fee3fd9ac1d..637323331f58 100644
--- a/src/bootstrap/lib.rs
+++ b/src/bootstrap/lib.rs
@@ -1026,7 +1026,7 @@ impl Build {
}
fn llvm_link_tools_dynamically(&self, target: Interned<String>) -> bool {
- (target.contains("linux-gnu") || target.contains("apple-darwin"))
+ target.contains("linux-gnu") || target.contains("apple-darwin")
}
/// Returns the `version` string associated with this compiler for Rust
--
2.24.1

View file

@ -0,0 +1,32 @@
commit ab998a2eeb2bcdc69ce70c814af97f0d1302a404 (from d17f62d857c70508efbf60be41135880bcd2e062)
Merge: d17f62d857c7 9452a8dfa3ba
Author: Mazdak Farrokhzad <twingoow@gmail.com>
Date: Thu Jan 24 00:20:00 2019 +0100
Rollup merge of #57840 - tromey:fix-issue-57762, r=nikic
Fix issue 57762
against a stock LLVM 7. LLVM 7 was released without a necessary fix
for a bug in the DWARF discriminant code.
This patch changes rustc to use the fallback mode on (non-Rust) LLVM 7.
Closes #57762
diff --git a/src/librustc_codegen_llvm/debuginfo/metadata.rs b/src/librustc_codegen_llvm/debuginfo/metadata.rs
index 6deedd0b5ea3..9f63038c3623 100644
--- a/src/librustc_codegen_llvm/debuginfo/metadata.rs
+++ b/src/librustc_codegen_llvm/debuginfo/metadata.rs
@@ -1164,7 +1164,10 @@ fn use_enum_fallback(cx: &CodegenCx) -> bool {
// On MSVC we have to use the fallback mode, because LLVM doesn't
// lower variant parts to PDB.
return cx.sess().target.target.options.is_like_msvc
- || llvm_util::get_major_version() < 7;
+ // LLVM version 7 did not release with an important bug fix;
+ // but the required patch is in the LLVM 8. Rust LLVM reports
+ // 8 as well.
+ || llvm_util::get_major_version() < 8;
}
// FIXME(eddyb) maybe precompute this? Right now it's computed once

View file

@ -0,0 +1,210 @@
commit 9423c4f0dda638ec2a925140850b85e8d3e6d455 (from bee074f032970fd1b59650c04a70e75eeee9c63b)
Merge: bee074f03297 3a2a4429a288
Author: Mazdak Farrokhzad <twingoow@gmail.com>
Date: Mon Mar 23 10:29:13 2020 +0100
Rollup merge of #70123 - cuviper:library-path, r=Mark-Simulacrum
Ensure LLVM is in the link path for rustc tools
The build script for `rustc_llvm` outputs LLVM information in `cargo:rustc-link-lib` and `cargo:rustc-link-search` so the compiler can be linked correctly. However, while the lib is carried along in metadata, the search paths are not. So when cargo is invoked again later for rustc _tools_, they'll also try to link with LLVM, but the necessary paths may be left out.
Rustbuild can use the environment to set the LLVM link path for tools -- `LIB` for MSVC toolchains and `LIBRARY_PATH` for everyone else.
Fixes #68714.
diff --git a/src/bootstrap/builder.rs b/src/bootstrap/builder.rs
index 602e4511ea58..dd519506d42a 100644
--- a/src/bootstrap/builder.rs
+++ b/src/bootstrap/builder.rs
@@ -11,7 +11,7 @@ use std::path::{Path, PathBuf};
use std::process::Command;
use std::time::{Duration, Instant};
-use build_helper::t;
+use build_helper::{output, t};
use crate::cache::{Cache, Interned, INTERNER};
use crate::check;
@@ -23,7 +23,7 @@ use crate::install;
use crate::native;
use crate::test;
use crate::tool;
-use crate::util::{self, add_lib_path, exe, libdir};
+use crate::util::{self, add_dylib_path, add_link_lib_path, exe, libdir};
use crate::{Build, DocTests, GitRepo, Mode};
pub use crate::Compiler;
@@ -660,7 +660,7 @@ impl<'a> Builder<'a> {
return;
}
- add_lib_path(vec![self.rustc_libdir(compiler)], &mut cmd.command);
+ add_dylib_path(vec![self.rustc_libdir(compiler)], &mut cmd.command);
}
/// Gets a path to the compiler specified.
@@ -698,6 +698,20 @@ impl<'a> Builder<'a> {
cmd
}
+ /// Return the path to `llvm-config` for the target, if it exists.
+ ///
+ /// Note that this returns `None` if LLVM is disabled, or if we're in a
+ /// check build or dry-run, where there's no need to build all of LLVM.
+ fn llvm_config(&self, target: Interned<String>) -> Option<PathBuf> {
+ if self.config.llvm_enabled() && self.kind != Kind::Check && !self.config.dry_run {
+ let llvm_config = self.ensure(native::Llvm { target });
+ if llvm_config.is_file() {
+ return Some(llvm_config);
+ }
+ }
+ None
+ }
+
/// Prepares an invocation of `cargo` to be run.
///
/// This will create a `Command` that represents a pending execution of
@@ -1034,6 +1048,17 @@ impl<'a> Builder<'a> {
.env("RUSTC_SNAPSHOT_LIBDIR", self.rustc_libdir(compiler));
}
+ // Tools that use compiler libraries may inherit the `-lLLVM` link
+ // requirement, but the `-L` library path is not propagated across
+ // separate Cargo projects. We can add LLVM's library path to the
+ // platform-specific environment variable as a workaround.
+ if mode == Mode::ToolRustc {
+ if let Some(llvm_config) = self.llvm_config(target) {
+ let llvm_libdir = output(Command::new(&llvm_config).arg("--libdir"));
+ add_link_lib_path(vec![llvm_libdir.trim().into()], &mut cargo);
+ }
+ }
+
if self.config.incremental {
cargo.env("CARGO_INCREMENTAL", "1");
} else {
diff --git a/src/bootstrap/compile.rs b/src/bootstrap/compile.rs
index 65a00db33949..ad494b88b3af 100644
--- a/src/bootstrap/compile.rs
+++ b/src/bootstrap/compile.rs
@@ -451,44 +451,6 @@ impl Step for Rustc {
false,
);
- // We used to build librustc_codegen_llvm as a separate step,
- // which produced a dylib that the compiler would dlopen() at runtime.
- // This meant that we only needed to make sure that libLLVM.so was
- // installed by the time we went to run a tool using it - since
- // librustc_codegen_llvm was effectively a standalone artifact,
- // other crates were completely oblivious to its dependency
- // on `libLLVM.so` during build time.
- //
- // However, librustc_codegen_llvm is now built as an ordinary
- // crate during the same step as the rest of the compiler crates.
- // This means that any crates depending on it will see the fact
- // that it uses `libLLVM.so` as a native library, and will
- // cause us to pass `-llibLLVM.so` to the linker when we link
- // a binary.
- //
- // For `rustc` itself, this works out fine.
- // During the `Assemble` step, we call `dist::maybe_install_llvm_dylib`
- // to copy libLLVM.so into the `stage` directory. We then link
- // the compiler binary, which will find `libLLVM.so` in the correct place.
- //
- // However, this is insufficient for tools that are build against stage0
- // (e.g. stage1 rustdoc). Since `Assemble` for stage0 doesn't actually do anything,
- // we won't have `libLLVM.so` in the stage0 sysroot. In the past, this wasn't
- // a problem - we would copy the tool binary into its correct stage directory
- // (e.g. stage1 for a stage1 rustdoc built against a stage0 compiler).
- // Since libLLVM.so wasn't resolved until runtime, it was fine for it to
- // not exist while we were building it.
- //
- // To ensure that we can still build stage1 tools against a stage0 compiler,
- // we explicitly copy libLLVM.so into the stage0 sysroot when building
- // the stage0 compiler. This ensures that tools built against stage0
- // will see libLLVM.so at build time, making the linker happy.
- if compiler.stage == 0 {
- builder.info(&format!("Installing libLLVM.so to stage 0 ({})", compiler.host));
- let sysroot = builder.sysroot(compiler);
- dist::maybe_install_llvm_dylib(builder, compiler.host, &sysroot);
- }
-
builder.ensure(RustcLink {
compiler: builder.compiler(compiler.stage, builder.config.build),
target_compiler: compiler,
diff --git a/src/bootstrap/tool.rs b/src/bootstrap/tool.rs
index 67e0ed5c5802..c8ccba467e50 100644
--- a/src/bootstrap/tool.rs
+++ b/src/bootstrap/tool.rs
@@ -12,7 +12,7 @@ use crate::channel;
use crate::channel::GitInfo;
use crate::compile;
use crate::toolstate::ToolState;
-use crate::util::{add_lib_path, exe, CiEnv};
+use crate::util::{add_dylib_path, exe, CiEnv};
use crate::Compiler;
use crate::Mode;
@@ -388,7 +388,7 @@ pub struct ErrorIndex {
impl ErrorIndex {
pub fn command(builder: &Builder<'_>, compiler: Compiler) -> Command {
let mut cmd = Command::new(builder.ensure(ErrorIndex { compiler }));
- add_lib_path(
+ add_dylib_path(
vec![PathBuf::from(&builder.sysroot_libdir(compiler, compiler.host))],
&mut cmd,
);
@@ -689,7 +689,7 @@ impl<'a> Builder<'a> {
}
}
- add_lib_path(lib_paths, &mut cmd);
+ add_dylib_path(lib_paths, &mut cmd);
cmd
}
}
diff --git a/src/bootstrap/util.rs b/src/bootstrap/util.rs
index eac790fe504b..2bc6f1939d97 100644
--- a/src/bootstrap/util.rs
+++ b/src/bootstrap/util.rs
@@ -40,7 +40,7 @@ pub fn libdir(target: &str) -> &'static str {
}
/// Adds a list of lookup paths to `cmd`'s dynamic library lookup path.
-pub fn add_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
+pub fn add_dylib_path(path: Vec<PathBuf>, cmd: &mut Command) {
let mut list = dylib_path();
for path in path {
list.insert(0, path);
@@ -72,6 +72,31 @@ pub fn dylib_path() -> Vec<PathBuf> {
env::split_paths(&var).collect()
}
+/// Adds a list of lookup paths to `cmd`'s link library lookup path.
+pub fn add_link_lib_path(path: Vec<PathBuf>, cmd: &mut Command) {
+ let mut list = link_lib_path();
+ for path in path {
+ list.insert(0, path);
+ }
+ cmd.env(link_lib_path_var(), t!(env::join_paths(list)));
+}
+
+/// Returns the environment variable which the link library lookup path
+/// resides in for this platform.
+fn link_lib_path_var() -> &'static str {
+ if cfg!(target_env = "msvc") { "LIB" } else { "LIBRARY_PATH" }
+}
+
+/// Parses the `link_lib_path_var()` environment variable, returning a list of
+/// paths that are members of this lookup path.
+fn link_lib_path() -> Vec<PathBuf> {
+ let var = match env::var_os(link_lib_path_var()) {
+ Some(v) => v,
+ None => return vec![],
+ };
+ env::split_paths(&var).collect()
+}
+
/// `push` all components to `buf`. On windows, append `.exe` to the last component.
pub fn push_exe_path(mut buf: PathBuf, components: &[&str]) -> PathBuf {
let (&file, components) = components.split_last().expect("at least one component required");

View file

@ -0,0 +1,175 @@
commit 374ab25585f0a817fe7bd6986737f12347b12d0b (from 1add455ec6f81045e7651c6225902823f5d4fbfa)
Merge: 1add455ec6f8 497f879b1e24
Author: bors <bors@rust-lang.org>
Date: Tue Mar 24 12:42:54 2020 +0000
Auto merge of #70163 - nikic:llvm-10-preparation, r=cuviper
Prepare for LLVM 10 upgrade
This is #67759 minus the submodule update.
* Fix two compatibility issues in the rustllvm wrapper.
* Update data layout strings in tests.
* Fix LLVM version comparison (this become a problem because the major version has two digits now).
r? @cuviper
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index aa1d1b7c4241..b52fbe4666eb 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -1141,6 +1141,8 @@ impl Step for Compiletest {
let llvm_config = builder.ensure(native::Llvm { target: builder.config.build });
if !builder.config.dry_run {
let llvm_version = output(Command::new(&llvm_config).arg("--version"));
+ // Remove trailing newline from llvm-config output.
+ let llvm_version = llvm_version.trim_end();
cmd.arg("--llvm-version").arg(llvm_version);
}
if !builder.is_rust_llvm(target) {
diff --git a/src/rustllvm/PassWrapper.cpp b/src/rustllvm/PassWrapper.cpp
index 90d24d20737d..9e8614e3b6d3 100644
--- a/src/rustllvm/PassWrapper.cpp
+++ b/src/rustllvm/PassWrapper.cpp
@@ -67,7 +67,11 @@ extern "C" void LLVMInitializePasses() {
}
extern "C" void LLVMTimeTraceProfilerInitialize() {
-#if LLVM_VERSION_GE(9, 0)
+#if LLVM_VERSION_GE(10, 0)
+ timeTraceProfilerInitialize(
+ /* TimeTraceGranularity */ 0,
+ /* ProcName */ "rustc");
+#elif LLVM_VERSION_GE(9, 0)
timeTraceProfilerInitialize();
#endif
}
diff --git a/src/rustllvm/RustWrapper.cpp b/src/rustllvm/RustWrapper.cpp
index 25cfee3373dc..799adb418822 100644
--- a/src/rustllvm/RustWrapper.cpp
+++ b/src/rustllvm/RustWrapper.cpp
@@ -1333,8 +1333,13 @@ extern "C" LLVMValueRef LLVMRustBuildMemSet(LLVMBuilderRef B,
LLVMValueRef Dst, unsigned DstAlign,
LLVMValueRef Val,
LLVMValueRef Size, bool IsVolatile) {
+#if LLVM_VERSION_GE(10, 0)
+ return wrap(unwrap(B)->CreateMemSet(
+ unwrap(Dst), unwrap(Val), unwrap(Size), MaybeAlign(DstAlign), IsVolatile));
+#else
return wrap(unwrap(B)->CreateMemSet(
unwrap(Dst), unwrap(Val), unwrap(Size), DstAlign, IsVolatile));
+#endif
}
extern "C" LLVMValueRef
diff --git a/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json b/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
index 8d028280a8da..00de3de05f07 100644
--- a/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
+++ b/src/test/run-make-fulldeps/target-specs/my-awesome-platform.json
@@ -1,5 +1,5 @@
{
- "data-layout": "e-m:e-p:32:32-f64:32:64-f80:32-n8:16:32-S128",
+ "data-layout": "e-m:e-p:32:32-p270:32:32-p271:32:32-p272:64:64-f64:32:64-f80:32-n8:16:32-S128",
"linker-flavor": "gcc",
"llvm-target": "i686-unknown-linux-gnu",
"target-endian": "little",
diff --git a/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json b/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
index 48040ae3da0e..6d5e964ed4fe 100644
--- a/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
+++ b/src/test/run-make-fulldeps/target-specs/my-x86_64-unknown-linux-gnu-platform.json
@@ -1,6 +1,6 @@
{
"pre-link-args": {"gcc": ["-m64"]},
- "data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
+ "data-layout": "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-f80:128-n8:16:32:64-S128",
"linker-flavor": "gcc",
"llvm-target": "x86_64-unknown-linux-gnu",
"target-endian": "little",
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 2a24a8c3c948..cb648db8830e 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -191,6 +191,7 @@ impl EarlyProps {
return true;
}
if let Some(ref actual_version) = config.llvm_version {
+ let actual_version = version_to_int(actual_version);
if line.starts_with("min-llvm-version") {
let min_version = line
.trim_end()
@@ -199,7 +200,7 @@ impl EarlyProps {
.expect("Malformed llvm version directive");
// Ignore if actual version is smaller the minimum required
// version
- &actual_version[..] < min_version
+ actual_version < version_to_int(min_version)
} else if line.starts_with("min-system-llvm-version") {
let min_version = line
.trim_end()
@@ -208,7 +209,7 @@ impl EarlyProps {
.expect("Malformed llvm version directive");
// Ignore if using system LLVM and actual version
// is smaller the minimum required version
- config.system_llvm && &actual_version[..] < min_version
+ config.system_llvm && actual_version < version_to_int(min_version)
} else if line.starts_with("ignore-llvm-version") {
// Syntax is: "ignore-llvm-version <version1> [- <version2>]"
let range_components = line
@@ -219,15 +220,15 @@ impl EarlyProps {
.take(3) // 3 or more = invalid, so take at most 3.
.collect::<Vec<&str>>();
match range_components.len() {
- 1 => &actual_version[..] == range_components[0],
+ 1 => actual_version == version_to_int(range_components[0]),
2 => {
- let v_min = range_components[0];
- let v_max = range_components[1];
+ let v_min = version_to_int(range_components[0]);
+ let v_max = version_to_int(range_components[1]);
if v_max < v_min {
panic!("Malformed LLVM version range: max < min")
}
// Ignore if version lies inside of range.
- &actual_version[..] >= v_min && &actual_version[..] <= v_max
+ actual_version >= v_min && actual_version <= v_max
}
_ => panic!("Malformed LLVM version directive"),
}
@@ -238,6 +239,20 @@ impl EarlyProps {
false
}
}
+
+ fn version_to_int(version: &str) -> u32 {
+ let version_without_suffix = version.split('-').next().unwrap();
+ let components: Vec<u32> = version_without_suffix
+ .split('.')
+ .map(|s| s.parse().expect("Malformed version component"))
+ .collect();
+ match components.len() {
+ 1 => components[0] * 10000,
+ 2 => components[0] * 10000 + components[1] * 100,
+ 3 => components[0] * 10000 + components[1] * 100 + components[2],
+ _ => panic!("Malformed version"),
+ }
+ }
}
}
diff --git a/src/tools/compiletest/src/header/tests.rs b/src/tools/compiletest/src/header/tests.rs
index 6c478f7e29da..31d991e0c2f8 100644
--- a/src/tools/compiletest/src/header/tests.rs
+++ b/src/tools/compiletest/src/header/tests.rs
@@ -122,9 +122,8 @@ fn llvm_version() {
config.llvm_version = Some("9.3.1-rust-1.43.0-dev".to_owned());
assert!(!parse_rs(&config, "// min-llvm-version 9.2").ignore);
- // FIXME.
- // config.llvm_version = Some("10.0.0-rust".to_owned());
- // assert!(!parse_rs(&config, "// min-llvm-version 9.0").ignore);
+ config.llvm_version = Some("10.0.0-rust".to_owned());
+ assert!(!parse_rs(&config, "// min-llvm-version 9.0").ignore);
}
#[test]

View file

@ -0,0 +1,40 @@
commit 6067315d58ff3d49b305ae3c99810656856c8e21
Author: Josh Stone <jistone@redhat.com>
Date: Mon Mar 30 14:03:39 2020 -0700
Ensure LLVM is in the link path for "fulldeps" tests
This is a follow-up to #70123, which added `llvm-config --libdir` to the
`LIBRARY_PATH` for rustc tools. We need the same for "run-make-fulldeps"
and "ui-fulldeps" tests which depend on compiler libraries, implicitly
needing to link to `-lLLVM` as well.
diff --git a/src/bootstrap/test.rs b/src/bootstrap/test.rs
index 5b946b05735d..2499856235f1 100644
--- a/src/bootstrap/test.rs
+++ b/src/bootstrap/test.rs
@@ -21,7 +21,7 @@ use crate::flags::Subcommand;
use crate::native;
use crate::tool::{self, SourceType, Tool};
use crate::toolstate::ToolState;
-use crate::util::{self, dylib_path, dylib_path_var};
+use crate::util::{self, add_link_lib_path, dylib_path, dylib_path_var};
use crate::Crate as CargoCrate;
use crate::{envify, DocTests, GitRepo, Mode};
@@ -1178,6 +1178,15 @@ impl Step for Compiletest {
cmd.arg("--system-llvm");
}
+ // Tests that use compiler libraries may inherit the `-lLLVM` link
+ // requirement, but the `-L` library path is not propagated across
+ // separate compilations. We can add LLVM's library path to the
+ // platform-specific environment variable as a workaround.
+ if !builder.config.dry_run && suite.ends_with("fulldeps") {
+ let llvm_libdir = output(Command::new(&llvm_config).arg("--libdir"));
+ add_link_lib_path(vec![llvm_libdir.trim().into()], &mut cmd);
+ }
+
// Only pass correct values for these flags for the `run-make` suite as it
// requires that a C++ compiler was configured which isn't always the case.
if !builder.config.dry_run && suite == "run-make-fulldeps" {

172
rust.spec
View file

@ -19,15 +19,15 @@
# Only x86_64 and i686 are Tier 1 platforms at this time.
# https://forge.rust-lang.org/platform-support.html
%define rust_arches x86_64 %{ix86}
%define rust_arches x86_64 %{ix86} aarch64
# To bootstrap from scratch, set the channel and date from src/stage0.txt
# e.g. 1.10.0 wants rustc: 1.9.0-2016-05-24
# or nightly wants some beta-YYYY-MM-DD
# Note that cargo matches the program version here, not its crate version.
%define bootstrap_rust 1.30.0
%define bootstrap_cargo 1.30.0
%define bootstrap_date 2018-10-25
%define bootstrap_rust 1.42.0
%define bootstrap_cargo 1.42.0
%define bootstrap_date 2020-03-12
%bcond_without bootstrap
@ -44,20 +44,15 @@
# LLDB isn't available everywhere...
%bcond_with lldb
# Some sub-packages are versioned independently of the rust compiler and runtime itself.
# Also beware that if any of these are not changed in a version bump, then the release
# number should still increase, not be reset to 1!
%define rustc_version 1.31.0
%define cargo_version 1.31.0
%define rustfmt_version 1.0.0
%define rls_version 1.31.6
%define clippy_version 0.0.212
%ifarch x86_64
%define rust_triple x86_64-unknown-linux-gnu
%else
%endif
%ifarch %{ix86}
%define rust_triple i686-unknown-linux-gnu
%endif
%ifarch aarch64
%define rust_triple aarch64-unknown-linux-gnu
%endif
%ifarch %{bootstrap_arches}
%define bootstrap_root rust-%{bootstrap_rust}-%{rust_triple}
@ -66,21 +61,33 @@
%define local_rust_root %{_prefix}
%endif
%bcond_with clang
Summary: The Rust Programming Language
Name: rust
Version: %{rustc_version}
Release: 8
Version: 1.43.0
Release: 1
License: (ASL 2.0 or MIT) and (BSD and MIT)
Group: Development/Rust
# ^ written as: (rust itself) and (bundled libraries)
Url: https://www.rust-lang.org
Source0: https://static.rust-lang.org/dist/rustc-%{rustc_version}-src.tar.xz
Source0: https://static.rust-lang.org/dist/rustc-%{version}-src.tar.xz
# For bootstrap
Source1: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-x86_64-unknown-linux-gnu.tar.xz
Source2: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-i686-unknown-linux-gnu.tar.xz
Source3: https://static.rust-lang.org/dist/rust-%{bootstrap_rust}-aarch64-unknown-linux-gnu.tar.xz
Source10: rust.rpmlintrc
# https://github.com/rust-lang/rust/pull/56394
Patch1: 0001-Deal-with-EINTR-in-net-timeout-tests.patch
# Revert https://github.com/rust-lang/rust/pull/57840
# We do have the necessary fix in our LLVM 7.
Patch1: rust-pr57840-llvm7-debuginfo-variants.patch
# Ensure LLVM is in the link path for rustc tools and "fulldeps" tests
# https://github.com/rust-lang/rust/pull/70123
# https://github.com/rust-lang/rust/pull/70591
Patch2: rust-pr70123-ensure-llvm-is-in-the-link-path.patch
Patch3: rust-pr70591-ensure-llvm-is-in-the-link-path.patch
# Prepare for LLVM 10 upgrade
# https://github.com/rust-lang/rust/pull/70163
Patch4: rust-pr70163-prepare-for-llvm-10-upgrade.patch
BuildRequires: ncurses-devel
BuildRequires: curl
BuildRequires: pkgconfig(libcurl)
@ -91,7 +98,10 @@ BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(libssh2) >= 1.6.0
BuildRequires: pkgconfig(python3)
BuildRequires: cmake >= 2.8.11
BuildRequires: llvm-devel >= 5.0
%if %{with clang}
BuildRequires: clang
%endif
BuildRequires: llvm-devel >= 6.0
%if %{with llvm_static}
BuildRequires: pkgconfig(libffi)
%endif
@ -102,13 +112,12 @@ BuildRequires: gdb
%if %{without bootstrap}
BuildRequires: cargo >= %{bootstrap_cargo}
BuildRequires: %{name} >= %{bootstrap_rust}
#Conflicts: %%{name} > %%{rustc_version}
#Conflicts: %%{name} > %%{version}
%endif
# Virtual provides for folks who attempt "dnf install rustc"
Provides: rustc = %{rustc_version}-%{release}
Provides: rustc = %{version}-%{release}
# Always require our exact standard library
Requires: %{name}-std-static = %{rustc_version}-%{release}
Requires: %{name}-std-static = %{version}-%{release}
%description
Rust is a systems programming language that runs blazingly fast, prevents
@ -118,6 +127,7 @@ This package includes the Rust compiler and documentation generator.
%files
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%doc vendor/backtrace-sys/src/libbacktrace/LICENSE-libbacktrace
%{_bindir}/rustc
%{_bindir}/rustdoc
%{_libdir}/*.so
@ -127,7 +137,9 @@ This package includes the Rust compiler and documentation generator.
%dir %{rustlibdir}/%{rust_triple}
%dir %{rustlibdir}/%{rust_triple}/lib
%{rustlibdir}/%{rust_triple}/lib/*.so
%{rustlibdir}/%{rust_triple}/codegen-backends/
# %%exclude - No work!
#%%exclude %%{_bindir}/*miri
%{_bindir}/*miri
#-------------------------------------------------------------------------
@ -162,6 +174,9 @@ for %{name}-gdb and %{name}-lldb.
%dir %{rustlibdir}
%dir %{rustlibdir}/etc
%{rustlibdir}/etc/debugger_*.py*
%if %rpm4
%{rustlibdir}/etc/__pycache__/debugger_*.py*
%endif
#-------------------------------------------------------------------------
@ -169,7 +184,7 @@ for %{name}-gdb and %{name}-lldb.
Summary: GDB pretty printers for Rust
Group: Development/Rust
Requires: gdb
Requires: %{name}-debugger-common = %{rustc_version}-%{release}
Requires: %{name}-debugger-common = %{version}-%{release}
BuildArch: noarch
# (akien) Handle moved files between our old Mageia package and this Fedora-based one
Conflicts: rust < 1.11.0-3
@ -182,6 +197,12 @@ which allows easier debugging of Rust programs.
%doc README.md COPYRIGHT LICENSE-APACHE LICENSE-MIT
%{_bindir}/rust-gdb
%{rustlibdir}/etc/gdb_*.py*
%if %rpm4
%{rustlibdir}/etc/__pycache__/gdb_*.py*
%endif
# %%exclude - No work!
#%%exclude %%{_bindir}/rust-gdbgui
%{_bindir}/rust-gdbgui
#-------------------------------------------------------------------------
%if %{with lldb}
@ -190,10 +211,13 @@ which allows easier debugging of Rust programs.
Summary: LLDB pretty printers for Rust
Group: Development/Rust
Requires: lldb
%if %{mdvver} > 201610
Requires: python3-lldb
%else
Requires: python-lldb
Requires: %{name}-debugger-common = %{rustc_version}-%{release}
# It could be noarch, but lldb has limited availability
#BuildArch: noarch
%endif
Requires: %{name}-debugger-common = %{version}-%{release}
BuildArch: noarch
%description lldb
This package includes the rust-lldb script,
@ -209,13 +233,16 @@ which allows easier debugging of Rust programs.
%package -n cargo
Summary: Rust's package manager and build tool
Version: %{cargo_version}
Group: Development/Rust
# For tests:
BuildRequires: git
# Cargo is not much use without Rust
Requires: rust
Obsoletes: cargo < 1.26.0-1
# "cargo vendor" is a builtin command starting with 1.37. The Obsoletes and
# Provides are mostly relevant to RHEL, but harmless to have on Fedora/etc. too
Obsoletes: cargo-vendor <= 0.1.23
Provides: cargo-vendor = %{version}-%{release}
%description -n cargo
Cargo is a tool that allows Rust projects to declare their various dependencies
@ -235,11 +262,10 @@ and ensure that you'll always get a repeatable build.
%package -n rustfmt
Summary: Tool to find and fix Rust formatting issues
Group: Development/Rust
Version: %{rustfmt_version}
Requires: cargo
# The component/package was rustfmt-preview until Rust 1.31.
Obsoletes: rustfmt-preview < 1.0.0
Provides: rustfmt-preview = %{rustfmt_version}-%{release}
Provides: rustfmt-preview = %{version}-%{release}
%description -n rustfmt
A tool for formatting Rust code according to style guidelines.
@ -253,15 +279,13 @@ A tool for formatting Rust code according to style guidelines.
%package -n rls
Summary: Rust Language Server for IDE integration
Version: %{rls_version}
Group: Development/Rust
Provides: rls = %{rls_version}
Requires: rust-analysis
# /usr/bin/rls is dynamically linked against internal rustc libs
Requires: %{name} = %{rustc_version}-%{release}
Requires: %{name} = %{version}-%{release}
# The component/package was rls-preview until Rust 1.31.
Obsoletes: rls-preview < 1.31.6
Provides: rls-preview = %{rls_version}-%{release}
Provides: rls-preview = %{version}-%{release}
%description -n rls
The Rust Language Server provides a server that runs in the background,
@ -277,15 +301,13 @@ reformatting, and code completion, and enables renaming and refactorings.
%package -n clippy
Summary: Lints to catch common mistakes and improve your Rust code
Version: %{clippy_version}
Group: Development/Rust
Provides: clippy = %{clippy_version}
Requires: cargo
# /usr/bin/clippy-driver is dynamically linked against internal rustc libs
Requires: %{name} = %{rustc_version}-%{release}
Requires: %{name} = %{version}-%{release}
# The component/package was clippy-preview until Rust 1.31.
Obsoletes: clippy-preview <= 0.0.212
Provides: clippy-preview = %{clippy_version}-%{release}
Provides: clippy-preview = %{version}-%{release}
%description -n clippy
A collection of lints to catch common mistakes and improve your Rust code.
@ -317,7 +339,7 @@ useful as a reference for code completion tools in various editors.
%package analysis
Summary: Compiler analysis data for the Rust standard library
Group: Development/Rust
Requires: rust-std-static = %{rustc_version}-%{release}
Requires: rust-std-static = %{version}-%{release}
%description analysis
This package contains analysis data files produced with rustc's -Zsave-analysis
@ -334,9 +356,13 @@ data to provide information about the Rust standard library.
%ifarch %{bootstrap_arches}
%ifarch x86_64
tar xf %{SOURCE1}
%else
%endif
%ifarch %{ix86}
tar xf %{SOURCE2}
%endif
%ifarch aarch64
tar xf %{SOURCE3}
%endif
cd rust-%{bootstrap_rust}-%{rust_triple}
./install.sh --components=cargo,rustc,rust-std-%{rust_triple} \
--prefix=%{local_rust_root} --disable-ldconfig
@ -344,31 +370,29 @@ test -f '%{local_rust_root}/bin/cargo'
test -f '%{local_rust_root}/bin/rustc'
%endif
%if %{without bootstrap}
%patch1 -p1
%endif
%setup -qn rustc-%{version}-src
%setup -qn rustc-%{rustc_version}-src
%patch1 -p1 -R
%patch2 -p1
%patch3 -p1
%patch4 -p1
# python3
sed -i.try-py3 -e '/try python2.7/i try python3 "$@"' ./configure
# We're disabling jemalloc, but rust-src still wants it.
# rm -rf src/jemalloc/
rm -rf src/llvm/
# We never enable emscripten.
rm -rf src/llvm-emscripten/
# Remove other unused vendored libraries
rm -rf vendor/jemalloc-sys/jemalloc/
rm -rf vendor/libz-sys/src/zlib/
rm -rf vendor/lzma-sys/xz-*/
rm -rf vendor/openssl-src/openssl/
# We never enable other LLVM tools.
rm -rf src/tools/clang
rm -rf src/tools/lld
rm -rf src/tools/lldb
# This only affects the transient rust-installer, but let it use our dynamic xz-libs
sed -i.lzma -e '/LZMA_API_STATIC/d' src/bootstrap/tool.rs
# extract bundled licenses for packaging
sed -e '/*\//q' src/libbacktrace/backtrace.h \
>src/libbacktrace/LICENSE-libbacktrace
# rename bundled license for packaging
cp -a vendor/backtrace-sys/src/libbacktrace/LICENSE{,-libbacktrace}
%if %{with llvm_static}
# Static linking to distro LLVM needs to add -lffi
@ -380,10 +404,20 @@ sed -i.ffi -e '$a #[link(name = "ffi")] extern {}' \
# The configure macro will modify some autoconf-related files, which upsets
# cargo when it tries to verify checksums in those files. If we just truncate
# that file list, cargo won't have anything to complain about.
find src/vendor -name .cargo-checksum.json \
find vendor -name .cargo-checksum.json \
-exec sed -i.uncheck -e 's/"files":{[^}]*}/"files":{ }/' '{}' '+'
# Sometimes Rust sources start with #![...] attributes, and "smart" editors think
# it's a shebang and make them executable. Then brp-mangle-shebangs gets upset...
find -name '*.rs' -type f -perm /111 -exec chmod -v -x '{}' '+'
%build
%if %{with clang}
%global optflags %{nil}
export CC=clang
export CXX=clang++
%endif
# Use hardening ldflags.
%if %{without bootstrap}
%ifarch x86_64
@ -400,18 +434,21 @@ export LIBSSH2_SYS_USE_PKG_CONFIG=1
export RUSTFLAGS="%{rustflags}"
%configure2_5x \
%configure \
--disable-option-checking \
--libdir=%{_libdir} \
--build=%{rust_triple} --host=%{rust_triple} --target=%{rust_triple} \
--python=python3 \
--local-rust-root=%{local_rust_root} \
--llvm-root=%{_prefix} \
--disable-codegen-tests \
--disable-jemalloc \
--disable-rpath \
--enable-extended \
--enable-vendor \
--release-channel=stable \
%if %{mdkver} > 201610
--set rust.codegen-units-std=1 \
%endif
--disable-debuginfo \
--disable-debuginfo-only-std \
--disable-debuginfo-tools \
@ -429,15 +466,17 @@ DESTDIR=%{buildroot} python3 ./x.py install
find %{buildroot}%{_libdir} -maxdepth 1 -type f -name '*.so' \
-exec chmod -v +x '{}' '+'
# The libdir libraries are identical to those under rustlib/. It's easier on
# The libdir libraries are identical to those under rustlib/. It's easier on
# library loading if we keep them in libdir, but we do need them in rustlib/
# to support dynamic linking for compiler plugins, so we'll symlink.
(cd "%{buildroot}%{rustlibdir}/%{rust_triple}/lib" &&
find ../../../../%{_lib} -maxdepth 1 -name '*.so' |
while read lib; do
# make sure they're actually identical!
cmp "$lib" "${lib##*/}"
ln -v -f -s -t . "$lib"
if [ -f "${lib##*/}" ]; then
# make sure they're actually identical!
cmp "$lib" "${lib##*/}"
ln -v -f -s -t . "$lib"
fi
done)
# Remove installer artifacts (manifests, uninstall scripts, etc.)
@ -459,6 +498,9 @@ rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-MIT
rm -f %{buildroot}%{_docdir}/%{name}/LICENSE-THIRD-PARTY
rm -f %{buildroot}%{_docdir}/%{name}/*.old
# Delete the HTML documentation
rm -rf %{buildroot}%{_docdir}/%{name}/html
# Create the path for crate-devel packages
mkdir -p %{buildroot}%{_datadir}/cargo/registry