Skip to content

fix(llvm,llvm20): add azurelinux-specific triple to clang default fallback list#17607

Merged
ddstreetmicrosoft merged 2 commits into
4.0from
tobiasb-ms/add-azurelinux-to-llvm-triples
Jun 11, 2026
Merged

fix(llvm,llvm20): add azurelinux-specific triple to clang default fallback list#17607
ddstreetmicrosoft merged 2 commits into
4.0from
tobiasb-ms/add-azurelinux-to-llvm-triples

Conversation

@tobiasb-ms

Copy link
Copy Markdown
Contributor

Summary

Add x86_64-azurelinux-linux and aarch64-azurelinux-linux to clang's GCC installation fallback triple list in Gnu.cpp. This allows clang-based tools (clang-tidy, clang++, etc.) to discover GCC headers installed under the Azure Linux vendor-specific triple without requiring explicit --gcc-toolchain or -isystem flags.

Problem

clang's GCC installation detector searches a hardcoded list of vendor triples when locating the system GCC. Azure Linux uses {arch}-azurelinux-linux as its vendor triple (visible in /usr/lib/gcc/x86_64-azurelinux-linux/), but this wasn't in clang's fallback list. As a result, clang-tidy and other tools failed to find <cstdio> and other libstdc++ headers, causing %check failures in packages like meson that run clang-tidy during their test suites.

Fixes: Bug #20333[Nightly Break] meson: %check fails - clang-tidy unit tests cannot find <cstdio>

Related: Bug #20284, Bug #20324 (ROCm/clang toolchain gap — same root cause)

Testing

  • Both llvm and llvm20 built successfully on ControlTower
  • meson built successfully (including %check) with the updated llvm in the local buildroot
  • Patch includes upstream-style test cases in clang/test/Driver/linux-ld.c

Changes

  • llvm (21.x): add patch, bump release
  • llvm20: add same patch, bump release

Copilot AI review requested due to automatic review settings June 2, 2026 19:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR updates the Azure Linux llvm and llvm20 components to ensure clang can discover GCC installs under Azure Linux’s vendor triple ({arch}-azurelinux-linux) by patching clang’s GCC-install fallback triple lists and adding upstream-style driver tests.

Changes:

  • Add x86_64-azurelinux-linux and aarch64-azurelinux-linux to clang’s fallback triple detection in Gnu.cpp.
  • Add clang driver tests (and minimal test sysroot inputs) to validate the fallback detection works for both x86_64 and aarch64.
  • Bump rendered spec releases / lock fingerprints for both llvm and llvm20 to reflect the change.

Reviewed changes

Copilot reviewed 8 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
base/comps/llvm/llvm.comp.toml Adds patch overlay + manual patch application hook for llvm.
base/comps/llvm/0001-Clang-Add-azurelinux-to-fallback-triples.patch Carries clang triple/test changes as a patch source.
base/comps/llvm20/llvm20.comp.toml Adds the same patch overlay + manual application hook for llvm20.
base/comps/llvm20/0001-Clang-Add-azurelinux-to-fallback-triples.patch Carries clang triple/test changes as a patch source for llvm20.
specs/l/llvm/llvm.spec Rendered spec update: adds Patch2202, applies it, bumps release/changelog.
specs/l/llvm/0001-Clang-Add-azurelinux-to-fallback-triples.patch Rendered copy of the patch under specs/.
specs/l/llvm20/llvm20.spec Rendered spec update: adds Patch2202, applies it, bumps release/changelog.
specs/l/llvm20/0001-Clang-Add-azurelinux-to-fallback-triples.patch Rendered copy of the patch under specs/.
locks/llvm.lock Updates input fingerprint after component change.
locks/llvm20.lock Updates input fingerprint after component change.

Comment thread base/comps/llvm/llvm.comp.toml Outdated
Comment thread base/comps/llvm20/llvm20.comp.toml Outdated
Comment thread specs/l/llvm/llvm.spec Outdated
Comment thread specs/l/llvm20/llvm20.spec Outdated
Comment thread specs/l/llvm/llvm.spec Outdated
Comment thread specs/l/llvm20/llvm20.spec Outdated
@tobiasb-ms tobiasb-ms marked this pull request as draft June 2, 2026 21:51
@tobiasb-ms tobiasb-ms force-pushed the tobiasb-ms/add-azurelinux-to-llvm-triples branch from 5bdb24d to 483ddb4 Compare June 3, 2026 15:51
@tobiasb-ms tobiasb-ms marked this pull request as ready for review June 3, 2026 15:59
static const char *const AArch64Triples[] = {
- "aarch64-none-linux-gnu", "aarch64-redhat-linux", "aarch64-suse-linux"};
+ "aarch64-none-linux-gnu", "aarch64-redhat-linux", "aarch64-suse-linux",
+ "aarch64-azurelinux-linux"};

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I'm not thrilled by this...as the comment just a few lines above says, "Please don't add more elements to *Triples". But digging into how to avoid this ourselves probably isn't appropriate or worth the time (trying to get upstream to fix the need for this hardcoded list is the right way to avoid this).

So this looks ok to me.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Agree, though options are limited. I do think that the Fedora change https://src.fedoraproject.org/rpms/llvm/c/879a14ed99a04dbfca4e3c3c57abb33b61e1a3dc?branch=rawhide will mostly obviate the need for this as it will install the config files that have these triples with clang-libs rather than clang. But this fallback is probably good to have anyway.

FWIW, I've also submitted a PR to LLVM: llvm/llvm-project#200894, but not traction thus far (and as the you suggest, based on the comment, I wouldn't be surprised if they reject it).

@ddstreetmicrosoft ddstreetmicrosoft merged commit 7613d9d into 4.0 Jun 11, 2026
11 checks passed
@ddstreetmicrosoft ddstreetmicrosoft deleted the tobiasb-ms/add-azurelinux-to-llvm-triples branch June 11, 2026 14:27
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.

4 participants