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 (15be58d7f0)
 * [rust-only] Fix build with GCC 5.4 (774edc10fa)
 * ~~[rust-only] Fix build with GCC 5.2 (1a6069a7bb)~~
 * ~~[rust-only] Fix ICE with GCC 5.2 (493081f290)~~
 * ~~[rust-only] Fix build with GCC 5.2 (0fc5979d73)~~
 * [backported] Addition of `+atomics` target feature (57bdd9892d).
 * [backported] Revert compiler-rt change that broke powerpc (9c68b43915)
 * [awaiting backport] Fix RelLookupTableConverter on gnux32 (639388a05f / https://github.com/llvm/llvm-project/issues/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`
This commit is contained in:
bors 2022-08-12 02:58:51 +00:00
commit e2b52ff73e
22 changed files with 73 additions and 28 deletions

View File

@ -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
@ -432,7 +432,7 @@ 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
@ -440,7 +440,7 @@ 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
os: windows-latest-xl

2
.gitmodules vendored
View File

@ -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

View File

@ -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),
);

View File

@ -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);

View File

@ -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,

View File

@ -325,6 +325,9 @@ fn run(self, builder: &Builder<'_>) -> PathBuf {
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 {

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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 \

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -596,14 +596,18 @@ 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
@ -611,14 +615,20 @@ jobs:
- 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
@ -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
@ -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

@ -1 +1 @@
Subproject commit 8b6b5014fdad3a750f7242a6bfdcad83619498d4
Subproject commit e3be3f64ecac101d14ceda759ba078ad0aaf3747

View File

@ -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