Skip to content

Commit

Permalink
chore: Update to LLVM 19
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
vadorovsky committed Aug 10, 2024
1 parent 7585ff7 commit b6a291c
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 16 deletions.
31 changes: 23 additions & 8 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -152,15 +149,29 @@ jobs:
- uses: taiki-e/install-action@cargo-hack

- name: Check
if: matrix.llvm == 'source'
run: cargo hack check --feature-powerset --features llvm-sys/force-dynamic

- name: Check
if: matrix.llvm != 'source'
run: cargo hack check --feature-powerset

- name: Build
if: matrix.llvm == 'source'
run: cargo hack build --feature-powerset --features llvm-sys/force-dynamic

- name: Build
if: matrix.llvm != 'source'
run: cargo hack build --feature-powerset

- name: Test
if: matrix.rust == 'nightly'
if: matrix.llvm == 'source' && matrix.rust == 'nightly'
run: cargo hack test --feature-powerset --features llvm-sys/force-dynamic

- name: Test
if: matrix.llvm != 'source' && matrix.rust == 'nightly'
run: cargo hack test --feature-powerset

- uses: actions/checkout@v4
if: matrix.rust == 'nightly'
with:
Expand All @@ -169,9 +180,13 @@ jobs:
submodules: recursive

- name: Install
if: matrix.rust == 'nightly'
if: matrix.llvm == 'source' && matrix.rust == 'nightly'
run: cargo install --path . --no-default-features --features llvm-sys/force-dynamic

- name: Install
if: matrix.llvm != 'source' && matrix.rust == 'nightly'
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
if: matrix.rust == 'nightly' && runner.arch == 'ARM64'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 16 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b6a291c

Please sign in to comment.