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

Lines changed: 6 additions & 6 deletions
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 0 deletions
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

Lines changed: 7 additions & 0 deletions
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

Lines changed: 3 additions & 1 deletion
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

Lines changed: 3 additions & 0 deletions
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

Lines changed: 2 additions & 1 deletion
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

0 commit comments

Comments
 (0)