Skip to content

Update to LLVM 15 #99464

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 12, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -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,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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions compiler/rustc_codegen_llvm/src/llvm_util.rs
Original file line number Diff line number Diff line change
@@ -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),
);

7 changes: 7 additions & 0 deletions compiler/rustc_llvm/build.rs
Original file line number Diff line number Diff line change
@@ -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);

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
@@ -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,
3 changes: 3 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
@@ -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 {
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
@@ -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

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

Original file line number Diff line number Diff line change
@@ -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
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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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 \
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
@@ -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
@@ -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
@@ -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

30 changes: 24 additions & 6 deletions src/ci/github-actions/ci.yml
Original file line number Diff line number Diff line change
@@ -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

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