From 68311bdf2bcddea8012fd9cec24357feaf771fd0 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 16 Oct 2017 12:45:24 -0700 Subject: [PATCH 1/4] Bump the minimum LLVM to 3.9 Old LLVM bugs are reportedly cropping up harder, but 3.9 seems to be OK. Fixes #45277. --- .travis.yml | 2 +- .../{x86_64-gnu-llvm-3.7 => x86_64-gnu-llvm-3.9}/Dockerfile | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) rename src/ci/docker/{x86_64-gnu-llvm-3.7 => x86_64-gnu-llvm-3.9}/Dockerfile (72%) diff --git a/.travis.yml b/.travis.yml index 139f06ec570..e97f9d9251f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,7 +12,7 @@ matrix: fast_finish: true include: # Images used in testing PR and try-build should be run first. - - env: IMAGE=x86_64-gnu-llvm-3.7 RUST_BACKTRACE=1 + - env: IMAGE=x86_64-gnu-llvm-3.9 RUST_BACKTRACE=1 if: type = pull_request OR branch = auto - env: IMAGE=dist-x86_64-linux DEPLOY=1 diff --git a/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile b/src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile similarity index 72% rename from src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile rename to src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile index e832a2445ba..6b818604898 100644 --- a/src/ci/docker/x86_64-gnu-llvm-3.7/Dockerfile +++ b/src/ci/docker/x86_64-gnu-llvm-3.9/Dockerfile @@ -11,7 +11,7 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ cmake \ sudo \ gdb \ - llvm-3.7-tools \ + llvm-3.9-tools \ libedit-dev \ zlib1g-dev \ xz-utils @@ -19,7 +19,9 @@ RUN apt-get update && apt-get install -y --no-install-recommends \ COPY scripts/sccache.sh /scripts/ RUN sh /scripts/sccache.sh +# using llvm-link-shared due to libffi issues -- see #34486 ENV RUST_CONFIGURE_ARGS \ --build=x86_64-unknown-linux-gnu \ - --llvm-root=/usr/lib/llvm-3.7 + --llvm-root=/usr/lib/llvm-3.9 \ + --enable-llvm-link-shared ENV RUST_CHECK_TARGET check From 7538a9b8afc42abfdc01afb4481a63dc3840f2ee Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 16 Oct 2017 12:48:01 -0700 Subject: [PATCH 2/4] Update the codegen/mainsubprogram tests to min-llvm 4.0 The necessary changes were only in upstream LLVM in 4.0, but they were for a while backported to Rust LLVM. Now that Rust LLVM is also 4.0, we can make the test conditional here more accurate. --- src/test/codegen/mainsubprogram.rs | 7 +++---- src/test/codegen/mainsubprogramstart.rs | 7 +++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/test/codegen/mainsubprogram.rs b/src/test/codegen/mainsubprogram.rs index 657f4b662f7..f0508bc90f2 100644 --- a/src/test/codegen/mainsubprogram.rs +++ b/src/test/codegen/mainsubprogram.rs @@ -8,14 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// The minimum LLVM version is set to 3.8, but really this test -// depends on a patch that is was committed to upstream LLVM before -// 4.0; and also backported to the Rust LLVM fork. +// This test depends on a patch that was committed to upstream LLVM +// before 4.0, formerly backported to the Rust LLVM fork. // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 3.8 +// min-llvm-version 4.0 // compile-flags: -g -C no-prepopulate-passes diff --git a/src/test/codegen/mainsubprogramstart.rs b/src/test/codegen/mainsubprogramstart.rs index cd34a1670dc..8325318f9af 100644 --- a/src/test/codegen/mainsubprogramstart.rs +++ b/src/test/codegen/mainsubprogramstart.rs @@ -8,14 +8,13 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// The minimum LLVM version is set to 3.8, but really this test -// depends on a patch that is was committed to upstream LLVM before -// 4.0; and also backported to the Rust LLVM fork. +// This test depends on a patch that was committed to upstream LLVM +// before 4.0, formerly backported to the Rust LLVM fork. // ignore-tidy-linelength // ignore-windows // ignore-macos -// min-llvm-version 3.8 +// min-llvm-version 4.0 // compile-flags: -g -C no-prepopulate-passes From 6f33108e4d13c018368fb7fd3c337718de89925e Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Mon, 16 Oct 2017 12:57:37 -0700 Subject: [PATCH 3/4] bootstrap: update and enable the LLVM version-check While the `config.toml.example` comments say "we automatically check the version by default," we actually didn't. That check was badly out of date, only allowing 3.5, 3.6, or 3.7. This it now updated to the new 3.9 minimum requirement, and truly enabled by default. --- config.toml.example | 2 +- src/bootstrap/config.rs | 1 + src/bootstrap/native.rs | 11 +++++++---- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/config.toml.example b/config.toml.example index f50543e18a7..261fe205387 100644 --- a/config.toml.example +++ b/config.toml.example @@ -35,7 +35,7 @@ # If an external LLVM root is specified, we automatically check the version by # default to make sure it's within the range that we're expecting, but setting # this flag will indicate that this version check should not be done. -#version-check = false +#version-check = true # Link libstdc++ statically into the librustc_llvm instead of relying on a # dynamic version to be available. diff --git a/src/bootstrap/config.rs b/src/bootstrap/config.rs index 69e0f58f1cd..d6c83e3acfc 100644 --- a/src/bootstrap/config.rs +++ b/src/bootstrap/config.rs @@ -299,6 +299,7 @@ impl Config { let mut config = Config::default(); config.llvm_enabled = true; config.llvm_optimize = true; + config.llvm_version_check = true; config.use_jemalloc = true; config.backtrace = true; config.rust_optimize = true; diff --git a/src/bootstrap/native.rs b/src/bootstrap/native.rs index 941ea96bbec..c37b1dad4c6 100644 --- a/src/bootstrap/native.rs +++ b/src/bootstrap/native.rs @@ -259,11 +259,14 @@ fn check_llvm_version(build: &Build, llvm_config: &Path) { let mut cmd = Command::new(llvm_config); let version = output(cmd.arg("--version")); - if version.starts_with("3.5") || version.starts_with("3.6") || - version.starts_with("3.7") { - return + let mut parts = version.split('.').take(2) + .filter_map(|s| s.parse::().ok()); + if let (Some(major), Some(minor)) = (parts.next(), parts.next()) { + if major > 3 || (major == 3 && minor >= 9) { + return + } } - panic!("\n\nbad LLVM version: {}, need >=3.5\n\n", version) + panic!("\n\nbad LLVM version: {}, need >=3.9\n\n", version) } #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] From 6309a475f912f8237cba57458bc598c2fc8fc90b Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 18 Oct 2017 07:54:35 -0700 Subject: [PATCH 4/4] Remove two obsolete min-llvm-version tests --- src/test/codegen/abi-x86-interrupt.rs | 1 - src/test/run-pass/issue-36023.rs | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/test/codegen/abi-x86-interrupt.rs b/src/test/codegen/abi-x86-interrupt.rs index 838cd4bf6d7..e0b37cb2f32 100644 --- a/src/test/codegen/abi-x86-interrupt.rs +++ b/src/test/codegen/abi-x86-interrupt.rs @@ -14,7 +14,6 @@ // ignore-arm // ignore-aarch64 -// min-llvm-version 3.8 // compile-flags: -C no-prepopulate-passes diff --git a/src/test/run-pass/issue-36023.rs b/src/test/run-pass/issue-36023.rs index 53a8a403b64..f6c03b384f2 100644 --- a/src/test/run-pass/issue-36023.rs +++ b/src/test/run-pass/issue-36023.rs @@ -8,8 +8,6 @@ // option. This file may not be copied, modified, or distributed // except according to those terms. -// min-llvm-version 3.9 - use std::ops::Deref; fn main() {