Skip to content

Commit e2b52ff

Browse files
committed
Auto merge of #99464 - nikic:llvm-15, r=cuviper
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`
2 parents b998821 + 115dfe2 commit e2b52ff

File tree

22 files changed

+73
-28
lines changed

22 files changed

+73
-28
lines changed

.github/workflows/ci.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -389,26 +389,26 @@ jobs:
389389
os: windows-latest-xl
390390
- name: i686-mingw-1
391391
env:
392-
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu"
392+
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
393393
SCRIPT: make ci-mingw-subset-1
394394
CUSTOM_MINGW: 1
395395
os: windows-latest-xl
396396
- name: i686-mingw-2
397397
env:
398-
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu"
398+
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --set llvm.allow-old-toolchain"
399399
SCRIPT: make ci-mingw-subset-2
400400
CUSTOM_MINGW: 1
401401
os: windows-latest-xl
402402
- name: x86_64-mingw-1
403403
env:
404404
SCRIPT: make ci-mingw-subset-1
405-
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler"
405+
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
406406
CUSTOM_MINGW: 1
407407
os: windows-latest-xl
408408
- name: x86_64-mingw-2
409409
env:
410410
SCRIPT: make ci-mingw-subset-2
411-
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler"
411+
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-profiler --set llvm.allow-old-toolchain"
412412
CUSTOM_MINGW: 1
413413
os: windows-latest-xl
414414
- name: dist-x86_64-msvc
@@ -432,15 +432,15 @@ jobs:
432432
os: windows-latest-xl
433433
- name: dist-i686-mingw
434434
env:
435-
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler"
435+
RUST_CONFIGURE_ARGS: "--build=i686-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
436436
SCRIPT: python x.py dist
437437
CUSTOM_MINGW: 1
438438
DIST_REQUIRE_ALL_TOOLS: 1
439439
os: windows-latest-xl
440440
- name: dist-x86_64-mingw
441441
env:
442442
SCRIPT: python x.py dist
443-
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler"
443+
RUST_CONFIGURE_ARGS: "--build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler --set llvm.allow-old-toolchain"
444444
CUSTOM_MINGW: 1
445445
DIST_REQUIRE_ALL_TOOLS: 1
446446
os: windows-latest-xl

.gitmodules

+1-1
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
[submodule "src/llvm-project"]
3535
path = src/llvm-project
3636
url = https://github.com/rust-lang/llvm-project.git
37-
branch = rustc/14.0-2022-06-20
37+
branch = rustc/15.0-2022-08-09
3838
[submodule "src/doc/embedded-book"]
3939
path = src/doc/embedded-book
4040
url = https://github.com/rust-embedded/book.git

compiler/rustc_codegen_llvm/src/llvm_util.rs

+2
Original file line numberDiff line numberDiff line change
@@ -440,6 +440,8 @@ pub(crate) fn global_llvm_features(sess: &Session, diagnostics: bool) -> Vec<Str
440440
.features
441441
.split(',')
442442
.filter(|v| !v.is_empty() && backend_feature_name(v).is_some())
443+
// Drop +atomics-32 feature introduced in LLVM 15.
444+
.filter(|v| *v != "+atomics-32" || get_version() >= (15, 0, 0))
443445
.map(String::from),
444446
);
445447

compiler/rustc_llvm/build.rs

+7
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,13 @@ fn main() {
242242
println!("cargo:rustc-link-lib=uuid");
243243
} else if target.contains("netbsd") || target.contains("haiku") || target.contains("darwin") {
244244
println!("cargo:rustc-link-lib=z");
245+
} else if target.starts_with("arm")
246+
|| target.starts_with("mips-")
247+
|| target.starts_with("mipsel-")
248+
|| target.starts_with("powerpc-")
249+
{
250+
// 32-bit targets need to link libatomic.
251+
println!("cargo:rustc-link-lib=atomic");
245252
}
246253
cmd.args(&components);
247254

compiler/rustc_target/src/spec/thumbv6m_none_eabi.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ pub fn target() -> Target {
1313
abi: "eabi".into(),
1414
// The ARMv6-M architecture doesn't support unaligned loads/stores so we disable them
1515
// with +strict-align.
16-
features: "+strict-align".into(),
16+
// Also force-enable 32-bit atomics, which allows the use of atomic load/store only.
17+
// The resulting atomics are ABI incompatible with atomics backed by libatomic.
18+
features: "+strict-align,+atomics-32".into(),
1719
// There are no atomic CAS instructions available in the instruction set of the ARMv6-M
1820
// architecture
1921
atomic_cas: false,

src/bootstrap/native.rs

+3
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,9 @@ impl Step for Llvm {
325325
cfg.define("LLVM_PROFDATA_FILE", &path);
326326
}
327327

328+
// Disable zstd to avoid a dependency on libzstd.so.
329+
cfg.define("LLVM_ENABLE_ZSTD", "OFF");
330+
328331
if target != "aarch64-apple-darwin" && !target.contains("windows") {
329332
cfg.define("LLVM_ENABLE_ZLIB", "ON");
330333
} else {

src/ci/docker/host-x86_64/arm-android/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ ENV PATH=$PATH:/android/sdk/platform-tools
2929

3030
ENV TARGETS=arm-linux-androideabi
3131

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

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

src/ci/docker/host-x86_64/dist-android/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ ENV RUST_CONFIGURE_ARGS \
3232
--i686-linux-android-ndk=/android/ndk/x86-14 \
3333
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
3434
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
35-
--disable-docs
35+
--disable-docs \
36+
--set llvm.allow-old-toolchain
3637

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

src/ci/docker/host-x86_64/dist-i586-gnu-i586-i686-musl/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ RUN /scripts/cmake.sh
3636
ENV RUST_CONFIGURE_ARGS \
3737
--musl-root-i586=/musl-i586 \
3838
--musl-root-i686=/musl-i686 \
39-
--disable-docs
39+
--disable-docs \
40+
--set llvm.allow-old-toolchain
4041

4142
# Newer binutils broke things on some vms/distros (i.e., linking against
4243
# unknown relocs disabled by the following flag), so we need to go out of our

src/ci/docker/host-x86_64/dist-mips-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ RUN /scripts/cmake.sh
2626

2727
ENV HOSTS=mips-unknown-linux-gnu
2828

29-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
29+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
30+
--set llvm.allow-old-toolchain
3031
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/dist-mips64-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ RUN /scripts/cmake.sh
2525

2626
ENV HOSTS=mips64-unknown-linux-gnuabi64
2727

28-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
28+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
29+
--set llvm.allow-old-toolchain
2930
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/dist-mips64el-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ RUN /scripts/cmake.sh
2626

2727
ENV HOSTS=mips64el-unknown-linux-gnuabi64
2828

29-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
29+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
30+
--set llvm.allow-old-toolchain
3031
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/dist-mipsel-linux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,6 @@ RUN /scripts/cmake.sh
2525

2626
ENV HOSTS=mipsel-unknown-linux-gnu
2727

28-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
28+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
29+
--set llvm.allow-old-toolchain
2930
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/dist-x86_64-netbsd/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,6 @@ ENV \
2121

2222
ENV HOSTS=x86_64-unknown-netbsd
2323

24-
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs
24+
ENV RUST_CONFIGURE_ARGS --enable-extended --disable-docs \
25+
--set llvm.allow-old-toolchain
2526
ENV SCRIPT python3 ../x.py dist --host $HOSTS --target $HOSTS

src/ci/docker/host-x86_64/i686-gnu-nopt/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ RUN mkdir -p /config
2727
RUN echo "[rust]" > /config/nopt-std-config.toml
2828
RUN echo "optimize = false" >> /config/nopt-std-config.toml
2929

30-
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests
30+
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu --disable-optimize-tests \
31+
--set llvm.allow-old-toolchain
3132
ENV SCRIPT python3 ../x.py test --stage 0 --config /config/nopt-std-config.toml library/std \
3233
&& python3 ../x.py --stage 2 test

src/ci/docker/host-x86_64/i686-gnu/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ RUN sh /scripts/sccache.sh
2323
COPY scripts/cmake.sh /scripts/
2424
RUN /scripts/cmake.sh
2525

26-
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu
26+
ENV RUST_CONFIGURE_ARGS --build=i686-unknown-linux-gnu \
27+
--set llvm.allow-old-toolchain
2728
# Exclude some tests that are unlikely to be platform specific, to speed up
2829
# this slow job.
2930
ENV SCRIPT python3 ../x.py --stage 2 test \

src/ci/docker/host-x86_64/x86_64-gnu-aux/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,6 @@ RUN sh /scripts/sccache.sh
2626
COPY scripts/cmake.sh /scripts/
2727
RUN /scripts/cmake.sh
2828

29-
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu
29+
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu \
30+
--set llvm.allow-old-toolchain
3031
ENV RUST_CHECK_TARGET check-aux

src/ci/docker/host-x86_64/x86_64-gnu-distcheck/Dockerfile

+2-1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ RUN sh /scripts/sccache.sh
2222
COPY scripts/cmake.sh /scripts/
2323
RUN /scripts/cmake.sh
2424

25-
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false
25+
ENV RUST_CONFIGURE_ARGS --build=x86_64-unknown-linux-gnu --set rust.ignore-git=false \
26+
--set llvm.allow-old-toolchain
2627
ENV SCRIPT python3 ../x.py --stage 2 test distcheck
2728
ENV DIST_SRC 1

src/ci/docker/host-x86_64/x86_64-gnu-tools/Dockerfile

+1
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ COPY host-x86_64/x86_64-gnu-tools/browser-ui-test.version /tmp/
8181
RUN npm install -g browser-ui-test@$(head -n 1 /tmp/browser-ui-test.version) --unsafe-perm=true
8282

8383
ENV RUST_CONFIGURE_ARGS \
84+
--set llvm.allow-old-toolchain \
8485
--build=x86_64-unknown-linux-gnu \
8586
--save-toolstates=/tmp/toolstate/toolstates.json
8687

src/ci/github-actions/ci.yml

+24-6
Original file line numberDiff line numberDiff line change
@@ -596,29 +596,39 @@ jobs:
596596

597597
- name: i686-mingw-1
598598
env:
599-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
599+
RUST_CONFIGURE_ARGS: >-
600+
--build=i686-pc-windows-gnu
601+
--set llvm.allow-old-toolchain
600602
SCRIPT: make ci-mingw-subset-1
601603
CUSTOM_MINGW: 1
602604
<<: *job-windows-xl
603605

604606
- name: i686-mingw-2
605607
env:
606-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu
608+
RUST_CONFIGURE_ARGS: >-
609+
--build=i686-pc-windows-gnu
610+
--set llvm.allow-old-toolchain
607611
SCRIPT: make ci-mingw-subset-2
608612
CUSTOM_MINGW: 1
609613
<<: *job-windows-xl
610614

611615
- name: x86_64-mingw-1
612616
env:
613617
SCRIPT: make ci-mingw-subset-1
614-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-profiler
618+
RUST_CONFIGURE_ARGS: >-
619+
--build=x86_64-pc-windows-gnu
620+
--enable-profiler
621+
--set llvm.allow-old-toolchain
615622
CUSTOM_MINGW: 1
616623
<<: *job-windows-xl
617624

618625
- name: x86_64-mingw-2
619626
env:
620627
SCRIPT: make ci-mingw-subset-2
621-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-profiler
628+
RUST_CONFIGURE_ARGS: >-
629+
--build=x86_64-pc-windows-gnu
630+
--enable-profiler
631+
--set llvm.allow-old-toolchain
622632
CUSTOM_MINGW: 1
623633
<<: *job-windows-xl
624634

@@ -663,7 +673,11 @@ jobs:
663673

664674
- name: dist-i686-mingw
665675
env:
666-
RUST_CONFIGURE_ARGS: --build=i686-pc-windows-gnu --enable-full-tools --enable-profiler
676+
RUST_CONFIGURE_ARGS: >-
677+
--build=i686-pc-windows-gnu
678+
--enable-full-tools
679+
--enable-profiler
680+
--set llvm.allow-old-toolchain
667681
SCRIPT: python x.py dist
668682
CUSTOM_MINGW: 1
669683
DIST_REQUIRE_ALL_TOOLS: 1
@@ -672,7 +686,11 @@ jobs:
672686
- name: dist-x86_64-mingw
673687
env:
674688
SCRIPT: python x.py dist
675-
RUST_CONFIGURE_ARGS: --build=x86_64-pc-windows-gnu --enable-full-tools --enable-profiler
689+
RUST_CONFIGURE_ARGS: >-
690+
--build=x86_64-pc-windows-gnu
691+
--enable-full-tools
692+
--enable-profiler
693+
--set llvm.allow-old-toolchain
676694
CUSTOM_MINGW: 1
677695
DIST_REQUIRE_ALL_TOOLS: 1
678696
<<: *job-windows-xl

src/llvm-project

src/test/run-make/coverage-llvmir/filecheck.testprog.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ CHECK-SAME: section "[[INSTR_PROF_COVFUN]]"[[COMDAT_IF_SUPPORTED]], align 8
99
CHECK: @__llvm_coverage_mapping = private constant
1010
CHECK-SAME: section "[[INSTR_PROF_COVMAP]]", align 8
1111

12-
WINDOWS: @__llvm_profile_runtime = external global i32
12+
WINDOWS: @__llvm_profile_runtime = external{{.*}}global i32
1313

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

0 commit comments

Comments
 (0)