← Back to Pull requests

feat(bazel): Wire hermetic-llvm as an opt-in toolchain for armv7 #61555

Open
unknown opened this pull request with 318 lines diff across 3 files
View on GitHub
unknown unknown commented on Nov 27, 2026 12:50 UTC
Author

What does this PR do?

Adds hermetic-llvm as a second toolchain for linux_armv7, without changing the default. MODULE.bazel registers an armv7 Linux LLVM target, and //bazel/platforms:linux_armv7 gets the libc, kernel, libstdc++ and FPU constraints that only hermetic-llvm reads. GCC is registered before @llvm_toolchains//:all, so it keeps winning wherever it can run (aarch64 Linux, which is where CI builds armhf).

It also carries hermeticbuild/hermetic-llvm#1003 (merged, not released yet) as bazel/patches/llvm/0002-fpu-vfpv3-d16.patch, because clang defaults armv7 to NEON + 32 D registers, which the GCC toolchain (armv7-a, vfpv3-d16) never emitted.

<details>
<summary>Functional changes</summary>

| Before | After |
| --- | --- |
| armv7 build on aarch64 Linux (CI bazel:package:iot:linux-armhf): GCC 13.2 | Same toolchain; the IoT agent binary is byte-identical to main |
| armv7 build with --extra_toolchains=@llvm_toolchains//:all: still GCC, there was no LLVM armv7 toolchain | hermetic-llvm builds it, at glibc 2.17, VFPv3-D16 without NEON, libstdc++ 13.2 |
| armv7 build on a macOS or x86_64 Linux host: toolchain resolution failed (the GCC armv7 toolchain only runs on aarch64 Linux) | Falls back to hermetic-llvm |

Unchanged: shipped armhf packages, and every other platform's toolchain. The patch changes the @llvm repo, so macOS and Windows LLVM actions rebuild once.

</details>

Motivation

First step of moving armv7 from GCC to hermetic-llvm without a flag day: the wiring lands now, and the remaining LLVM-only issues found in a spike (Go DWARF compression under LLD, nosys.so link libraries) get fixed against it before armv7 switches. glibc 2.17 is kept because it is the floor of both current armv7 builders (crosstool-NG sysroot and the CentOS 7 rpm_armhf image).

Describe how you validated your changes

On an aarch64 workspace:

  • --toolchain_resolution_debug: armv7 resolves to gcc_toolchain_armv7_13_2_0 by default and to hermetic-llvm with --extra_toolchains=@llvm_toolchains//:all.

  • //packages/iot:debian with GCC, built from main and from this branch in separate worktrees: same agent SHA-256, identical .deb contents.

  • //packages/iot:debian with LLVM: Tag_FP_arch: VFPv3-D16 with no NEON tag, 0 NEON / d16-d31 / FMA instructions (objdump -d, same as GCC), highest symbol GLIBC_2.8. NEEDED is GCC's set plus libm.so.6.

  • bazel run //bazel/buildifier:test.
  • The macOS / x86_64 host fallback follows from toolchain registration; I didn't run it.

    Diff: 318 lines (+238 / -80) across 3 files Reviewer: JSGette Review duration: 5875m
    All Vouch review confidence checks passed
    Residual risk 0.22 = Change Risk (0.40) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.40 · 318 lines diff across 3 files
    0.40
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.345
    Shallow Review Depth shallow_review_depth
    0.344
    Real PR Conversation Timeline
    1 comments
    "Review active on #61555"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 40.4% (MEDIUM) · Higher = larger blast radius
    40.4%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 46.7% · Lower = rushed or shallow review
    46.7%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 21.5% · Safe to merge
    21.5%