Skip to content

Commit

Permalink
Auto merge of #99464 - nikic:llvm-15, r=cuviper
Browse files Browse the repository at this point in the history
Update to LLVM 15

For preliminary testing. Some LLVM 15 compatibility fixes were applied separately in #99512.

Release timeline:
 * LLVM 15 branched on Jul 26.
 * The final LLVM 15.0.0 release is scheduled for Sep 6.
 * Current nightly (1.65.0) is scheduled for Nov 3.

Changes in this PR (apart from the LLVM update):
 * Pass `--set llvm.allow-old-toolchain` for many Docker images. LLVM 16 will require GCC >= 7.1, while LLVM 15 still allows older compilers with an option. Specify the option for builders still using GCC 5.4. #95026 updated some of the used toolchains, but not all.
 * Use the `+atomics-32` target feature for thumbv6m.
 * Explicitly link libatomic when cross-compiling LLVM to 32-bit target.
 * Explicitly disable zstd support, to avoid libzstd.so dependency.

New LLVM patches ([commits](https://github.com/rust-lang/llvm-project/commits/rustc/15.0-2022-08-09)):
 * [rust-only] Fix ICE with GCC 5.4 (nikic/llvm-project@15be58d)
 * [rust-only] Fix build with GCC 5.4 (nikic/llvm-project@774edc1)
 * ~~[rust-only] Fix build with GCC 5.2 (nikic/llvm-project@1a6069a7bb35ace1e40d566035cbf7ed2fa3b1f7)~~
 * ~~[rust-only] Fix ICE with GCC 5.2 (nikic/llvm-project@493081f2909206e0ed55af68a4058a76c0ad7a64)~~
 * ~~[rust-only] Fix build with GCC 5.2 (nikic/llvm-project@0fc5979d738c3a1f9510fe2d62417f7d2af37817)~~
 * [backported] Addition of `+atomics` target feature (llvm/llvm-project@57bdd98).
 * [backported] Revert compiler-rt change that broke powerpc (llvm/llvm-project@9c68b43)
 * [awaiting backport] Fix RelLookupTableConverter on gnux32 (nikic/llvm-project@639388a / llvm/llvm-project#57021)

Tested images: dist-x86_64-linux, armhf-gnu, arm-android, dist-s390x-linux, dist-x86_64-illumos, dist-x86_64-freebsd, wasm32, dist-x86_64-musl, dist-various-1, dist-riscv64-linux, dist-mips-linux, dist-mipsel-linux, dist-powerpc-linux, dist-aarch64-linux, dist-x86_64-apple, x86_64-msvc-1, x86_64-msvc-2, dist-various-2, dist-arm-linux
Tested up to the usual ipv6 error: test-various, i686-gnu, x86_64-gnu-nopt

r? `@ghost`
  • Loading branch information
bors committed Aug 12, 2022
2 parents b998821 + 115dfe2 commit e2b52ff
Show file tree
Hide file tree
Showing 22 changed files with 73 additions and 28 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -389,26 +389,26 @@ jobs:
os: windows-latest-xl
- name: i686-mingw-1
env:
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu"
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
SCRIPT: make ci-mingw-subset-1
CUSTOM_MINGW: 1
os: windows-latest-xl
- name: i686-mingw-2
env:
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu"
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
SCRIPT: make ci-mingw-subset-2
CUSTOM_MINGW: 1
os: windows-latest-xl
- name: x86_64-mingw-1
env:
SCRIPT: make ci-mingw-subset-1
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler"
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
CUSTOM_MINGW: 1
os: windows-latest-xl
- name: x86_64-mingw-2
env:
SCRIPT: make ci-mingw-subset-2
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler"
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
CUSTOM_MINGW: 1
os: windows-latest-xl
- name: dist-x86_64-msvc
Expand All @@ -432,15 +432,15 @@ jobs:
os: windows-latest-xl
- name: dist-i686-mingw
env:
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler"
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
SCRIPT: python x.py dist
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
os: windows-latest-xl
- name: dist-x86_64-mingw
env:
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler"
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
os: windows-latest-xl
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
[submodule "src/llvm-project"]
path = src/llvm-project
url = https://github.com/rust-lang/llvm-project.git
branch = rustc/14.0-2022-06-20
branch = rustc/15.0-2022-08-09
[submodule "src/doc/embedded-book"]
path = src/doc/embedded-book
url = https://github.com/rust-embedded/book.git
Expand Down
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
.features
.split(',')
.filter(|v| !v.is_empty() && backend_feature_name(v).is_some())
// Drop +atomics-32 feature introduced in LLVM 15.
.filter(|v| *v != "+atomics-32" || get_version() >= (15, 0, 0))
.map(String::from),
);

Expand Down
7 changes: 7 additions & 0 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,13 @@ fn main() {
println!("cargo:rustc-link-lib=uuid");
} else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
println!("cargo:rustc-link-lib=z");
} else if target.starts_with("arm")
|| target.starts_with("mips-")
|| target.starts_with("mipsel-")
|| target.starts_with("powerpc-")
{
// 32-bit targets need to link libatomic.
println!("cargo:rustc-link-lib=atomic");
}
cmd.args(&components);

Expand Down
4 changes: 3 additions & 1 deletion compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ pub fn target() -> Target {
abi: "eabi".into(),
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
// with +strict-align.
features: "+strict-align".into(),
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
features: "+strict-align,+atomics-32".into(),
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
// architecture
atomic_cas: false,
Expand Down
3 changes: 3 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,9 @@ impl Step for Llvm {
cfg.define("LLVM_PROFDATA_FILE", &path);
}

// Disable zstd to avoid a dependency on libzstd.so.
cfg.define("LLVM_ENABLE_ZSTD", "OFF");

if target != "aarch64-apple-darwin" && !target.contains("windows") {
cfg.define("LLVM_ENABLE_ZLIB", "ON");
} else {
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/arm-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ ENV PATH=$PATH:/android/sdk/platform-tools

ENV TARGETS=arm-linux-androideabi

ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14
ENV RUST_CONFIGURE_ARGS --arm-linux-androideabi-ndk=/android/ndk/arm-14 \
--set llvm.allow-old-toolchain

ENV SCRIPT python3 ../x.py --stage 2 test --host='' --target $TARGETS

Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-android/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ ENV RUST_CONFIGURE_ARGS \
--i686-linux-android-ndk=/android/ndk/x86-14 \
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
--disable-docs
--disable-docs \
--set llvm.allow-old-toolchain

ENV SCRIPT python3 ../x.py dist --host='' --target $TARGETS

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@ RUN /scripts/cmake.sh
ENV RUST_CONFIGURE_ARGS \
--musl-root-i586=/musl-i586 \
--musl-root-i686=/musl-i686 \
--disable-docs
--disable-docs \
--set llvm.allow-old-toolchain

# Newer binutils broke things on some vms/distros (i.e., linking against
# unknown relocs disabled by the following flag), so we need to go out of our
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ RUN /scripts/cmake.sh

ENV HOSTS=mips-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ RUN /scripts/cmake.sh

ENV HOSTS=mips64-unknown-linux-gnuabi64

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ RUN /scripts/cmake.sh

ENV HOSTS=mips64el-unknown-linux-gnuabi64

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,6 @@ RUN /scripts/cmake.sh

ENV HOSTS=mipsel-unknown-linux-gnu

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ ENV \

ENV HOSTS=x86_64-unknown-netbsd

ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ RUN mkdir -p /config
RUN echo "[rust]" > /config/nopt-std-config.toml
RUN echo "optimize = false" >> /config/nopt-std-config.toml

ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std \
&& python3 ../x.py --stage 2 test
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/i686-gnu/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh

ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu \
--set llvm.allow-old-toolchain
# Exclude some tests that are unlikely to be platform specific, to speed up
# this slow job.
ENV SCRIPT python3 ../x.py --stage 2 test \
Expand Down
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh

ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu \
--set llvm.allow-old-toolchain
ENV RUST_CHECK_TARGET check-aux
3 changes: 2 additions & 1 deletion src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN sh /scripts/sccache.sh
COPY scripts/cmake.sh /scripts/
RUN /scripts/cmake.sh

ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false \
--set llvm.allow-old-toolchain
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
ENV DIST_SRC 1
1 change: 1 addition & 0 deletions src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ COPY host-x86_64/x86_64-gnu-tools/browser-ui-test.version /tmp/
RUN npm install -g browser-ui-test@$(head -n 1 /tmp/browser-ui-test.version) --unsafe-perm=true

ENV RUST_CONFIGURE_ARGS \
--set llvm.allow-old-toolchain \
--build=x86_64-unknown-linux-gnu \
--save-toolstates=/tmp/toolstate/toolstates.json

Expand Down
30 changes: 24 additions & 6 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -596,29 +596,39 @@ jobs:

- name: i686-mingw-1
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
RUST_CONFIGURE_ARGS: >-
--build=i686-pc-windows-gnu
--set llvm.allow-old-toolchain
SCRIPT: make ci-mingw-subset-1
CUSTOM_MINGW: 1
<<: *job-windows-xl

- name: i686-mingw-2
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
RUST_CONFIGURE_ARGS: >-
--build=i686-pc-windows-gnu
--set llvm.allow-old-toolchain
SCRIPT: make ci-mingw-subset-2
CUSTOM_MINGW: 1
<<: *job-windows-xl

- name: x86_64-mingw-1
env:
SCRIPT: make ci-mingw-subset-1
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-profiler
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnu
--enable-profiler
--set llvm.allow-old-toolchain
CUSTOM_MINGW: 1
<<: *job-windows-xl

- name: x86_64-mingw-2
env:
SCRIPT: make ci-mingw-subset-2
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-profiler
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnu
--enable-profiler
--set llvm.allow-old-toolchain
CUSTOM_MINGW: 1
<<: *job-windows-xl

Expand Down Expand Up @@ -663,7 +673,11 @@ jobs:

- name: dist-i686-mingw
env:
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
RUST_CONFIGURE_ARGS: >-
--build=i686-pc-windows-gnu
--enable-full-tools
--enable-profiler
--set llvm.allow-old-toolchain
SCRIPT: python x.py dist
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
Expand All @@ -672,7 +686,11 @@ jobs:
- name: dist-x86_64-mingw
env:
SCRIPT: python x.py dist
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
RUST_CONFIGURE_ARGS: >-
--build=x86_64-pc-windows-gnu
--enable-full-tools
--enable-profiler
--set llvm.allow-old-toolchain
CUSTOM_MINGW: 1
DIST_REQUIRE_ALL_TOOLS: 1
<<: *job-windows-xl
Expand Down
2 changes: 1 addition & 1 deletion src/llvm-project
2 changes: 1 addition & 1 deletion src/test/run-make/coverage-llvmir/filecheck.testprog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
CHECK: @__llvm_coverage_mapping = private constant
CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8

WINDOWS: @__llvm_profile_runtime = external global i32
WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32

CHECK: @__profc__R{{[a-zA-Z0-9_]+}}testprog14will_be_called = {{private|internal}} global
CHECK-SAME: section "[[INSTR_PROF_CNTS]]"{{.*}}, align 8
Expand Down

0 comments on commit e2b52ff

Please sign in to comment.