From dd7d933da772214da4e4cbe8a87d85a3431813ec Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Sat, 10 Aug 2024 06:01:00 +0200 Subject: [PATCH] chore: Update to LLVM 19 Latest Rust nightly switched to LLVM 19, so we need to update in order to support rustc-llvm-proxy. LLVM 19 packages don't provide shared libraries anymore, so from now on, we use the `llvm-sys/force-dynamic` feaure only for LLVM built from source. --- .github/workflows/ci.yml | 17 +++++++---------- .github/workflows/llvm.yml | 2 +- Cargo.lock | 18 ++++++++++++++++-- Cargo.toml | 2 +- README.md | 8 ++++---- 5 files changed, 29 insertions(+), 18 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b9842f4b..b9dd5bca 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,12 +55,9 @@ jobs: rust: - stable - beta - # TODO: unpin nightly. There was a regression in - # https://github.com/rust-lang/rust/compare/1cec373f6...becebb315 that causes - # tests/btf/assembly/anon_struct_c.rs to fail to link. - - nightly-2024-04-16 + - nightly llvm: - - 18 + - 19 - source name: rustc=${{ matrix.rust }} llvm=${{ matrix.llvm }} needs: llvm @@ -121,7 +118,7 @@ jobs: echo -e deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-${{ matrix.llvm }} main | sudo tee /etc/apt/sources.list.d/llvm.list sudo apt update - sudo apt -y install llvm-${{ matrix.llvm }}-dev + sudo apt -y install llvm-${{ matrix.llvm }}-dev libpolly-${{ matrix.llvm }}-dev echo /usr/lib/llvm-${{ matrix.llvm }}/bin >> $GITHUB_PATH - name: Restore LLVM @@ -152,14 +149,14 @@ jobs: - uses: taiki-e/install-action@cargo-hack - name: Check - run: cargo hack check --feature-powerset --features llvm-sys/force-dynamic + run: cargo hack check --feature-powerset - name: Build - run: cargo hack build --feature-powerset --features llvm-sys/force-dynamic + run: cargo hack build --feature-powerset - name: Test if: matrix.rust == 'nightly' - run: cargo hack test --feature-powerset --features llvm-sys/force-dynamic + run: cargo hack test --feature-powerset - uses: actions/checkout@v4 if: matrix.rust == 'nightly' @@ -170,7 +167,7 @@ jobs: - name: Install if: matrix.rust == 'nightly' - run: cargo install --path . --no-default-features --features llvm-sys/force-dynamic + run: cargo install --path . --no-default-features # TODO: Remove this and run the integration tests on the local machine when they pass on 5.15. - name: Download debian kernels diff --git a/.github/workflows/llvm.yml b/.github/workflows/llvm.yml index 6fb0654a..bef08b21 100644 --- a/.github/workflows/llvm.yml +++ b/.github/workflows/llvm.yml @@ -16,7 +16,7 @@ jobs: - id: ls-remote run: | set -euxo pipefail - value=$(git ls-remote https://github.com/aya-rs/llvm-project.git refs/heads/rustc/18.0-2024-02-13 | cut -f1) + value=$(git ls-remote https://github.com/aya-rs/llvm-project.git refs/heads/rustc/19.1-2024-07-30 | cut -f1) echo "sha=$value" >> "$GITHUB_OUTPUT" - id: cache-key diff --git a/Cargo.lock b/Cargo.lock index be623371..5c5537ad 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -81,7 +81,7 @@ dependencies = [ "cargo_metadata", "libc", "libloading", - "llvm-sys", + "llvm-sys 180.0.0", "once_cell", "prettyplease", "quote", @@ -112,7 +112,7 @@ dependencies = [ "compiletest_rs", "gimli", "libc", - "llvm-sys", + "llvm-sys 191.0.0-rc1", "log", "regex", "rustc-build-sysroot", @@ -459,6 +459,20 @@ dependencies = [ "semver", ] +[[package]] +name = "llvm-sys" +version = "191.0.0-rc1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc981f56df5430a462d0f7676913fe9e8e4c8cc4df02e3157a6e3d808f7ae443" +dependencies = [ + "anyhow", + "cc", + "lazy_static", + "libc", + "regex-lite", + "semver", +] + [[package]] name = "log" version = "0.4.22" diff --git a/Cargo.toml b/Cargo.toml index f03c9491..598963b0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ ar = { version = "0.9.0" } aya-rustc-llvm-proxy = { version = "0.9.2", optional = true } gimli = { version = "0.31.0" } libc = { version = "0.2.155" } -llvm-sys = { features = ["disable-alltargets-init"], version = "180.0.0-rc2" } +llvm-sys = { features = ["disable-alltargets-init"], version = "191.0.0-rc1" } log = { version = "0.4.22" } thiserror = { version = "1.0.63" } tracing = "0.1" diff --git a/README.md b/README.md index ae7518e7..83fcde2c 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ files with embedded bitcode (.o), optionally stored inside ar archives (.a). ## Installation -The linker requires LLVM 18. It can use the same LLVM used by the rust compiler, +The linker requires LLVM 19. It can use the same LLVM used by the rust compiler, or it can use an external LLVM installation. If your target is `aarch64-unknown-linux-gnu` (i.e. Linux on Apple Silicon) you @@ -33,14 +33,14 @@ cargo install bpf-linker ### Using external LLVM -On Debian based distributions you need to install the `llvm-18-dev`, `libclang-18-dev` -and `libpolly-18-dev` packages. If your distro doesn't have them you can get them +On Debian based distributions you need to install the `llvm-19-dev`, `libclang-19-dev` +and `libpolly-19-dev` packages. If your distro doesn't have them you can get them from the official LLVM repo at https://apt.llvm.org. On rpm based distribution you need the `llvm-devel` and `clang-devel` packages. If your distro doesn't have them you can get them from Fedora Rawhide. -Once you have installed LLVM 18 you can install the linker running: +Once you have installed LLVM 19 you can install the linker running: ```sh cargo install bpf-linker --no-default-features