Skip to content

build: make LLVM 21 the default - #48

Open
zhouguangyuan0718 wants to merge 2 commits into
xgo-dev:xgofrom
zhouguangyuan0718:codex/default-llvm21
Open

build: make LLVM 21 the default#48
zhouguangyuan0718 wants to merge 2 commits into
xgo-dev:xgofrom
zhouguangyuan0718:codex/default-llvm21

Conversation

@zhouguangyuan0718

@zhouguangyuan0718 zhouguangyuan0718 commented Aug 15, 2026

Copy link
Copy Markdown

Summary

  • select LLVM 21 when no LLVM build tag is provided
  • retain LLVM 19 through the explicit llvm19 build tag
  • document the LLVM 14-22 support matrix and the new default

Motivation

LLGo is moving its revision-locked host and Espressif payload from LLVM 19 to LLVM 21. The binding already supports LLVM 21 APIs, including the captures(none) transition, but its no-tag CGO configuration still selects LLVM 19.

Keeping llvm19 explicit lets LLGo retain a compatibility lane while normal installs consistently select LLVM 21.

Validation

  • go test ./... with Homebrew LLVM 21.1.8
  • go test -tags=llvm19 ./... with Homebrew LLVM 19.1.7
  • GitHub Actions passed on Linux for LLVM 14-22
  • GitHub Actions passed on Fedora for LLVM 19-21
  • GitHub Actions passed on macOS for LLVM 14-22
  • git diff --check

After merge, LLGo will consume this change from the next tagged module release (v0.9.7).

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FennoAI Review

This PR switches the default LLVM version from 19 to 21 by swapping the build-tag roles between llvm_config_llvm19.go and llvm_config_llvm21.go, and updates the README accordingly.

The core change is correct. I verified across all llvm_config_llvm*.go files:

  • Build tags are mutually exclusive — no tag combination selects two config files, and there is no version gap (an untagged build resolves to the new llvm21 catch-all default).
  • llvm_config_llvm21.go correctly negates every explicitly-tagged version (14–20, 22) and its //go:build / // +build lines are consistent. llvm_config_llvm19.go correctly transitions to the explicit !byollvm && llvm19 gate.
  • README (versions list + "LLVM 21 is selected by default … -tags=llvm19") matches the actual code.

[P1] CI workflow still treats LLVM 19 as the default — not updated by this PR

.github/workflows/go.yml was not touched, but it hard-codes the old default. All three "Test default LLVM" steps still gate on the LLVM 19 matrix row:

  • test-macos: line 30 — if: matrix.llvm == 19
  • test-linux: line 55 — if: matrix.llvm == 19
  • test-linux-fedora: line 78 — if: matrix.llvm == 19

Since the untagged go test -v build now links LLVM 21, these steps run the default build against an environment where only LLVM 19 is installed, while no job validates the new default against an LLVM 21 install. The test-linux-fedora job is also internally inconsistent: its install step already treats matrix.llvm == 21 as the default (line 69), but its test step still uses matrix.llvm == 19 (line 78).

Suggested fix: change those three if: matrix.llvm == 19 conditions to if: matrix.llvm == 21.

Minor (non-blocking, pre-existing)

  • The llvm21 Linux CPPFLAGS/LDFLAGS omit the /usr/lib64/llvm*/... fallback paths present in the llvm19/llvm20 configs — a build-portability nit on RPM-based distros. Not introduced by this PR.
  • There is no llvm_config_windows_llvm21.go; the only Windows-specific config is still pinned to llvm20. Windows users of the new default fall through to the generic config.
  • The two changed files retain legacy // +build lines while the sibling files have dropped them — a cosmetic inconsistency only.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant