-
Notifications
You must be signed in to change notification settings - Fork 71
chore: upgrade LLVM to 22.1.4 #448
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
base: main
Are you sure you want to change the base?
Changes from 24 commits
1ef22ae
93b5310
7f612d9
d734725
fc7e2bc
99c8b0e
c7e7462
9e004a2
be37e95
b5be360
25a6e85
115fc4a
baffc35
42ae5f3
9d83938
8a1ff57
2701592
b6eaf21
a98c370
3e6e9c7
3ccd229
0bb19b6
5a06cd0
c609dc8
4adaa1e
ea07d04
4d82e38
a8720c9
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 |
|---|---|---|
|
|
@@ -17,6 +17,11 @@ on: | |
| required: false | ||
| type: boolean | ||
| default: false | ||
| skip_clice_build: | ||
| description: "Skip building and testing clice (LLVM-only build)" | ||
| required: false | ||
| type: boolean | ||
| default: false | ||
| pull_request: | ||
| # if you want to run this workflow, change the branch name to main, | ||
| # if you want to turn off it, change it to non existent branch. | ||
|
|
@@ -121,20 +126,48 @@ jobs: | |
| with: | ||
| environments: ${{ matrix.pixi_env || 'package' }} | ||
|
|
||
| - name: Free Disk Space (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: | | ||
| echo "=== Before cleanup ===" | ||
| df -h / | ||
|
|
||
| # Remove iOS/tvOS/watchOS/visionOS simulators | ||
| if [ -d "/Library/Developer/CoreSimulator" ]; then | ||
| sudo rm -rf /Library/Developer/CoreSimulator | ||
| echo "Removed CoreSimulator" | ||
| fi | ||
|
|
||
| # Remove unnecessary Xcode platforms (keep macOS only) | ||
| XCODE_PATH="$(xcode-select -p)" | ||
| PLATFORMS_DIR="${XCODE_PATH}/Platforms" | ||
| for platform in iPhoneOS.platform iPhoneSimulator.platform AppleTVOS.platform AppleTVSimulator.platform WatchOS.platform WatchSimulator.platform XROS.platform XRSimulator.platform; do | ||
| if [ -d "${PLATFORMS_DIR}/${platform}" ]; then | ||
| sudo rm -rf "${PLATFORMS_DIR}/${platform}" | ||
| echo "Removed ${platform}" | ||
| fi | ||
| done | ||
|
|
||
| # Remove Android SDK | ||
| sudo rm -rf ~/Library/Android | ||
|
|
||
| # Remove .NET/PowerShell | ||
| sudo rm -rf /usr/local/share/dotnet | ||
| sudo rm -rf /usr/local/share/powershell | ||
|
|
||
| # Remove Haskell | ||
| sudo rm -rf ~/.ghcup | ||
|
|
||
| echo "=== After cleanup ===" | ||
| df -h / | ||
|
|
||
| - name: Clone llvm-project | ||
| shell: bash | ||
| run: | | ||
| VERSION="${{ inputs.llvm_version || '21.1.8' }}" | ||
| echo "Cloning LLVM ${VERSION}..." | ||
| git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm | ||
|
|
||
| - name: Validate distribution components | ||
| shell: bash | ||
| run: | | ||
| python3 scripts/validate-llvm-components.py \ | ||
| --llvm-src=.llvm \ | ||
| --components-file=scripts/llvm-components.json | ||
|
|
||
| - name: Build LLVM (install-distribution) | ||
| shell: bash | ||
| run: | | ||
|
|
@@ -151,7 +184,7 @@ jobs: | |
| ${EXTRA_ARGS} | ||
|
|
||
| - name: Build clice using installed LLVM | ||
| if: ${{ !matrix.target_triple }} | ||
| if: ${{ !matrix.target_triple && !inputs.skip_clice_build }} | ||
| shell: bash | ||
| run: | | ||
| pixi run cmake-config ${{ matrix.llvm_mode }} ON -- \ | ||
|
|
@@ -160,7 +193,7 @@ jobs: | |
| pixi run cmake-build ${{ matrix.llvm_mode }} | ||
|
|
||
| - name: Build clice using installed LLVM (cross-compile) | ||
| if: ${{ matrix.target_triple }} | ||
| if: ${{ matrix.target_triple && !inputs.skip_clice_build }} | ||
| shell: bash | ||
| run: | | ||
| ENV="${{ matrix.pixi_env || 'package' }}" | ||
|
|
@@ -171,7 +204,7 @@ jobs: | |
| pixi run -e "$ENV" cmake-build ${{ matrix.llvm_mode }} | ||
|
|
||
| - name: Verify cross-compiled binary architecture | ||
| if: ${{ matrix.target_triple && runner.os != 'Windows' }} | ||
| if: ${{ matrix.target_triple && runner.os != 'Windows' && !inputs.skip_clice_build }} | ||
| shell: bash | ||
| run: | | ||
| BINARY="build/${{ matrix.llvm_mode }}/bin/clice" | ||
|
|
@@ -183,7 +216,7 @@ jobs: | |
| esac | ||
|
|
||
| - name: Upload cross-compiled clice for functional test | ||
| if: ${{ matrix.target_triple && matrix.lto == 'OFF' }} | ||
| if: ${{ matrix.target_triple && matrix.lto == 'OFF' && !inputs.skip_clice_build }} | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: cross-clice-${{ matrix.target_triple }}-${{ matrix.llvm_mode }} | ||
|
|
@@ -194,114 +227,34 @@ jobs: | |
| retention-days: 1 | ||
|
|
||
| - name: Run tests | ||
| if: ${{ !matrix.target_triple }} | ||
| if: ${{ !matrix.target_triple && !inputs.skip_clice_build }} | ||
| shell: bash | ||
| run: pixi run test ${{ matrix.llvm_mode }} | ||
|
|
||
| # Prune is only supported for native builds (requires linking clice to test). | ||
| # Cross-compiled targets reuse the native prune manifest of the same OS. | ||
| - name: Prune LLVM static libraries (Debug/RelWithDebInfo no LTO) | ||
| if: (!matrix.target_triple) && (matrix.llvm_mode == 'Debug' || (matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF')) | ||
| shell: bash | ||
| run: | | ||
| MANIFEST="pruned-libs-${{ matrix.os }}.json" | ||
| echo "LLVM_PRUNED_MANIFEST=${MANIFEST}" >> "${GITHUB_ENV}" | ||
| python3 scripts/prune-llvm-bin.py \ | ||
| --action discover \ | ||
| --install-dir ".llvm/build-install/lib" \ | ||
| --build-dir "build/${{ matrix.llvm_mode }}" \ | ||
| --max-attempts 60 \ | ||
| --sleep-seconds 60 \ | ||
| --manifest "${MANIFEST}" | ||
|
|
||
| - name: Upload pruned-libs manifest | ||
| if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'OFF' | ||
| uses: actions/upload-artifact@v4 | ||
| with: | ||
| name: llvm-pruned-libs-${{ matrix.os }} | ||
| path: ${{ env.LLVM_PRUNED_MANIFEST }} | ||
| if-no-files-found: error | ||
| compression-level: 0 | ||
|
|
||
| - name: Apply pruned-libs manifest (RelWithDebInfo + LTO, native only) | ||
| if: (!matrix.target_triple) && matrix.llvm_mode == 'RelWithDebInfo' && matrix.lto == 'ON' | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| MANIFEST="pruned-libs-${{ matrix.os }}.json" | ||
| python3 scripts/prune-llvm-bin.py \ | ||
| --action apply \ | ||
| --manifest "${MANIFEST}" \ | ||
| --install-dir ".llvm/build-install/lib" \ | ||
| --build-dir "build/${{ matrix.llvm_mode }}" \ | ||
| --gh-run-id "${{ github.run_id }}" \ | ||
| --gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \ | ||
| --gh-download-dir "artifacts" \ | ||
| --max-attempts 60 \ | ||
| --sleep-seconds 60 | ||
|
|
||
| # For cross-compiled LTO builds, apply the native prune manifest. | ||
| # The unused library set is arch-independent (same API surface). | ||
| - name: Apply pruned-libs manifest (cross-compile + LTO) | ||
| if: matrix.target_triple && matrix.lto == 'ON' | ||
| shell: bash | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| run: | | ||
| MANIFEST="pruned-libs-${{ matrix.os }}.json" | ||
| python3 scripts/prune-llvm-bin.py \ | ||
| --action apply \ | ||
| --manifest "${MANIFEST}" \ | ||
| --install-dir ".llvm/build-install/lib" \ | ||
| --build-dir "build/${{ matrix.llvm_mode }}" \ | ||
| --gh-run-id "${{ github.run_id }}" \ | ||
| --gh-artifact "llvm-pruned-libs-${{ matrix.os }}" \ | ||
| --gh-download-dir "artifacts" \ | ||
| --max-attempts 60 \ | ||
| --sleep-seconds 60 | ||
|
|
||
| - name: Package LLVM install directory | ||
| shell: bash | ||
| run: | | ||
| MODE_TAG="releasedbg" | ||
| if [[ "${{ matrix.llvm_mode }}" == "Debug" ]]; then | ||
| MODE_TAG="debug" | ||
| fi | ||
|
|
||
| # Determine arch/platform/toolchain from target triple or runner OS | ||
| # Determine platform/arch from target triple or runner OS | ||
| if [[ -n "${{ matrix.target_triple }}" ]]; then | ||
| case "${{ matrix.target_triple }}" in | ||
| x86_64-apple-darwin) | ||
| ARCH="x64"; PLATFORM="macos"; TOOLCHAIN="clang" ;; | ||
| aarch64-linux-gnu) | ||
| ARCH="aarch64"; PLATFORM="linux"; TOOLCHAIN="gnu" ;; | ||
| aarch64-pc-windows-msvc) | ||
| ARCH="aarch64"; PLATFORM="windows"; TOOLCHAIN="msvc" ;; | ||
| x86_64-apple-darwin) PLATFORM="macos"; ARCH="x64" ;; | ||
| aarch64-linux-gnu) PLATFORM="linux"; ARCH="aarch64" ;; | ||
| aarch64-pc-windows-msvc) PLATFORM="windows"; ARCH="aarch64" ;; | ||
| esac | ||
| else | ||
| ARCH="x64" | ||
| PLATFORM="linux" | ||
| TOOLCHAIN="gnu" | ||
| PLATFORM="linux"; ARCH="x64" | ||
| if [[ "${{ matrix.os }}" == windows-* ]]; then | ||
| PLATFORM="windows" | ||
| TOOLCHAIN="msvc" | ||
| elif [[ "${{ matrix.os }}" == macos-* ]]; then | ||
| ARCH="arm64" | ||
| PLATFORM="macos" | ||
| TOOLCHAIN="clang" | ||
| PLATFORM="macos"; ARCH="arm64" | ||
| fi | ||
| fi | ||
|
|
||
| SUFFIX="" | ||
| if [[ "${{ matrix.lto }}" == "ON" ]]; then | ||
| SUFFIX="-lto" | ||
| fi | ||
| if [[ "${{ matrix.llvm_mode }}" == "Debug" && "${{ matrix.os }}" != windows-* ]]; then | ||
| SUFFIX="${SUFFIX}-asan" | ||
| fi | ||
| NAME_ARGS="--platform $PLATFORM --arch $ARCH --mode ${{ matrix.llvm_mode }}" | ||
| if [[ "${{ matrix.lto }}" == "ON" ]]; then NAME_ARGS+=" --lto"; fi | ||
| if [[ "${{ matrix.llvm_mode }}" == "Debug" && "${{ matrix.os }}" != windows-* ]]; then NAME_ARGS+=" --asan"; fi | ||
|
|
||
| ARCHIVE="${ARCH}-${PLATFORM}-${TOOLCHAIN}-${MODE_TAG}${SUFFIX}.tar.xz" | ||
| ARCHIVE=$(python3 scripts/release-llvm.py artifact-name $NAME_ARGS) | ||
|
|
||
| set -eo pipefail | ||
| tar -C .llvm -cf - build-install | xz -T0 -9 -c > "${ARCHIVE}" | ||
|
Comment on lines
+190
to
193
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.
With the Useful? React with 👍 / 👎. |
||
|
|
@@ -316,6 +269,7 @@ jobs: | |
|
|
||
| test-cross: | ||
| needs: build | ||
| if: ${{ !inputs.skip_clice_build }} | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
|
|
||
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.
Template injection vulnerability from user-controlled input.
Direct interpolation of
${{ inputs.llvm_version }}into the shell script enables code injection if a malicious value is provided. While the attack surface is limited to users with workflow dispatch permissions, defense-in-depth recommends using theenvcontext instead.🔒 Recommended fix: pass input via env context
- name: Clone llvm-project shell: bash + env: + LLVM_VERSION: ${{ inputs.llvm_version }} run: | - VERSION="${{ inputs.llvm_version }}" + VERSION="${LLVM_VERSION}" echo "Cloning LLVM ${VERSION}..." git clone --branch "llvmorg-${VERSION}" --depth 1 https://github.com/llvm/llvm-project.git .llvm🧰 Tools
🪛 zizmor (1.25.2)
[error] 148-148: code injection via template expansion (template-injection): may expand into attacker-controllable code
(template-injection)
🤖 Prompt for AI Agents
Source: Linters/SAST tools