-
-
Notifications
You must be signed in to change notification settings - Fork 155
feat(codegen): make the in-process LLVM backend the default, statically linked #7353
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| name: Setup LLVM 22 | ||
| description: > | ||
| Provision the LLVM 22 development libraries that `llvm-inprocess` links | ||
| against, and export LLVM_SYS_221_PREFIX. Every job that compiles Rust needs | ||
| this now that the feature is on by default. | ||
|
|
||
| # One definition, not 44 inline recipes. The three platforms need three | ||
| # different sources and only one of them is obvious: | ||
| # | ||
| # macOS brew's llvm formula. | ||
| # Linux apt.llvm.org. The distro's `llvm-dev` is whatever the release | ||
| # froze on (Ubuntu 24.04 ships 18), so the LLVM project's own | ||
| # repository is the only way to get a pinned 22. | ||
| # Windows the official `clang+llvm-*-pc-windows-msvc` tarball. NOT | ||
| # chocolatey: its `llvm` package is the clang *toolchain* — no | ||
| # llvm-config.exe and none of the static libraries llvm-sys links | ||
| # against — and it has no 22.x pin at all. | ||
| # | ||
| # Every arm asserts the major version. llvm-sys 221 requires LLVM 22 | ||
| # specifically, and a runner image moving its formula on must fail loudly | ||
| # here rather than build something subtly different several steps later. | ||
| inputs: | ||
| version: | ||
| description: LLVM major.minor.patch used by the Windows tarball | ||
| required: false | ||
| default: "22.1.8" | ||
|
|
||
| runs: | ||
| using: composite | ||
| steps: | ||
| - name: LLVM 22 (macOS, brew) | ||
| if: runner.os == 'macOS' | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| brew install llvm@22 2>/dev/null || brew install llvm | ||
| PREFIX="$(brew --prefix llvm@22 2>/dev/null || brew --prefix llvm)" | ||
| "$PREFIX/bin/llvm-config" --version | grep -q '^22\.' \ | ||
| || { echo "::error::brew LLVM is not 22.x ($("$PREFIX/bin/llvm-config" --version))"; exit 1; } | ||
| echo "LLVM_SYS_221_PREFIX=$PREFIX" >> "$GITHUB_ENV" | ||
|
|
||
| - name: LLVM 22 (Linux, apt.llvm.org) | ||
| if: runner.os == 'Linux' | ||
| shell: bash | ||
| run: | | ||
| set -euo pipefail | ||
| wget -qO- https://apt.llvm.org/llvm-snapshot.gpg.key \ | ||
| | sudo tee /etc/apt/trusted.gpg.d/apt.llvm.org.asc >/dev/null | ||
| . /etc/os-release | ||
| echo "deb http://apt.llvm.org/${VERSION_CODENAME}/ llvm-toolchain-${VERSION_CODENAME}-22 main" \ | ||
| | sudo tee /etc/apt/sources.list.d/llvm22.list >/dev/null | ||
| sudo apt-get update -qq | ||
| sudo DEBIAN_FRONTEND=noninteractive apt-get install -y -qq \ | ||
| llvm-22-dev libpolly-22-dev libzstd-dev | ||
| llvm-config-22 --version | grep -q '^22\.' \ | ||
| || { echo "::error::apt LLVM is not 22.x"; exit 1; } | ||
| echo "LLVM_SYS_221_PREFIX=$(llvm-config-22 --prefix)" >> "$GITHUB_ENV" | ||
|
|
||
| - name: LLVM 22 (Windows, official MSVC tarball) | ||
| if: runner.os == 'Windows' | ||
| shell: pwsh | ||
| run: | | ||
| $ErrorActionPreference = "Stop" | ||
| $ver = "${{ inputs.version }}" | ||
| $url = "https://github.com/llvm/llvm-project/releases/download/llvmorg-$ver/clang+llvm-$ver-x86_64-pc-windows-msvc.tar.xz" | ||
| Write-Host "downloading $url" | ||
| curl.exe -sSL --retry 3 -o "$env:RUNNER_TEMP\llvm.tar.xz" $url | ||
| New-Item -ItemType Directory -Force -Path C:\llvm | Out-Null | ||
| tar -xf "$env:RUNNER_TEMP\llvm.tar.xz" -C C:\llvm --strip-components=1 | ||
| $v = & "C:\llvm\bin\llvm-config.exe" --version | ||
| if (-not $v.StartsWith("22.")) { Write-Error "LLVM is not 22.x ($v)"; exit 1 } | ||
| "LLVM_SYS_221_PREFIX=C:\llvm" | Out-File -FilePath $env:GITHUB_ENV -Append | ||
| Original file line number | Diff line number | Diff line change | ||||||
|---|---|---|---|---|---|---|---|---|
|
|
@@ -197,6 +197,7 @@ jobs: | |||||||
| - name: Install Rust toolchain | ||||||||
| if: steps.relevance.outputs.run == 'true' | ||||||||
| uses: dtolnay/rust-toolchain@stable | ||||||||
| - uses: ./.github/actions/setup-llvm22 | ||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win Apply the relevance condition to every LLVM setup step. Both jobs gate their expensive work on
Proposed fix - uses: ./.github/actions/setup-llvm22
+ if: steps.relevance.outputs.run == 'true'📝 Committable suggestion
Suggested change
📍 Affects 2 files
🤖 Prompt for AI Agents |
||||||||
|
|
||||||||
| - uses: Swatinem/rust-cache@v2 | ||||||||
| if: steps.relevance.outputs.run == 'true' | ||||||||
|
|
||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,6 +124,7 @@ jobs: | |
| with: | ||
| node-version-file: .node-version | ||
| - uses: dtolnay/rust-toolchain@stable | ||
| - uses: ./.github/actions/setup-llvm22 | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win Preserve the validated LLVM 22 prefix. Line 127 exports the prefix validated by 🤖 Prompt for AI Agents |
||
| - uses: Swatinem/rust-cache@v2 | ||
| with: | ||
| shared-key: gc-native-roots | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔒 Security & Privacy | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 11702
🌐 Web query:
Debian apt trusted.gpg.d global keyring signed-by apt-key apt-secure official documentation💡 Result:
In modern Debian systems, the use of apt-key and the global /etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/ keyrings is deprecated and discouraged [1][2][3]. The recommended practice is to use the signed-by option in your APT repository configuration to explicitly associate a repository with its specific public GPG key [1][4][5]. This approach prevents a key trusted for one repository from being automatically trusted for all repositories on the system, significantly enhancing security [6][5]. Recommended Workflow 1. Obtain the GPG key and ensure it is in the correct format (binary.gpg or ASCII-armored.asc) [4][7][2]. 2. Place the key file in a dedicated, secure directory: - Use /etc/apt/keyrings/ for administrator-managed keys [1][7][5]. - Use /usr/share/keyrings/ for keys managed by packages (e.g., provided by a.deb archive) [4][8][5]. - Ensure the file has appropriate read permissions (e.g., chmod 644) [5]. 3. Configure your repository by adding the signed-by option to your source entry [1][6]: - For a legacy.list file: deb [signed-by=/etc/apt/keyrings/example.gpg] https://example.com/debian stable main - For modern.sources files (deb822 format), you can either reference the file or embed the ASCII-armored key directly within the file [1][4][7]. Key Differences and Deprecation - apt-key: This utility is deprecated and has been removed in recent Debian releases (e.g., Debian 13) [9][2]. It should no longer be used for managing repository keys [1][3]. - Global Keyrings (/etc/apt/trusted.gpg and /etc/apt/trusted.gpg.d/): These locations are deprecated [3]. While some systems may still support them for backward compatibility, they are considered insecure because they grant global trust to any key placed within them [3][6][5]. - Signed-By: This option binds a specific repository to a specific key, providing a granular and secure mechanism for verifying package authenticity [4][6][5]. For more information, consult the apt-secure(8) manual page on your system, which provides the authoritative details on repository security and key configuration [4][3].
Citations:
Security Misconfiguration (CWE-345)
Reachability: External
Pin and scope the apt signing key.
The APT signing key is fetched at runtime and stored under global trusted APT metadata, so a compromised endpoint can make future packages from this source appear verified. Store the key in a repository-scoped keyring, verify a committed fingerprint before
apt-get update, and configuredeb [signed-by=...]instead of relying on/etc/apt/trusted.gpg.d.🤖 Prompt for AI Agents