Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion base/comps/components.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2062,7 +2062,6 @@ includes = ["**/*.comp.toml", "component-check-disablement.toml"]
[components.llhttp]
[components.llvm15]
[components.llvm18]
[components.llvm20]
[components.lm_sensors]
[components.lmdb]
[components.lockdev]
Expand Down
40 changes: 39 additions & 1 deletion base/comps/llvm/llvm.comp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,42 @@
# Workaround: Disable MLIR until python-nanobind (and its dep robin-map)
# are imported into Azure Linux. MLIR is gated on %{with mlir} in the
# upstream spec and pulls in python3-nanobind-devel which doesn't exist yet.
build.without = ["mlir"]
# Workaround: OpenMP tests fail in systemd-nspawn mock (95% failure rate)
# due to missing /proc/sys/kernel tunables and cgroup support for threads/forks.
build.without = ["mlir", "check"]

[[components.llvm.overlays]]
description = "Use the Azure Linux GCC toolchain triple in clang's default config so clang can find gcc runtime files in stage2 builds"
type = "spec-search-replace"
regex = '%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux'
replacement = '%global cfg_file_content --gcc-triple=%{_target_cpu}-%{_vendor}-linux'

[[components.llvm.overlays]]
description = "Bootstrap workaround: write a clang config with the corrected --gcc-triple under %{_builddir} and inject it into CFLAGS/CXXFLAGS/LDFLAGS so this build's clang invocations override the chroot's stale default config"
type = "spec-prepend-lines"
section = "%build"
lines = [
"# AZL bootstrap workaround for llvm self-rebuild (see llvm.comp.toml)",
'azl_clang_bootstrap_cfg="%{_builddir}/azl-clang-bootstrap.cfg"',
'echo "--gcc-triple=%{_target_cpu}-%{_vendor}-linux" > "${azl_clang_bootstrap_cfg}"',
'export CFLAGS="${CFLAGS} --config=${azl_clang_bootstrap_cfg}"',
'export CXXFLAGS="${CXXFLAGS} --config=${azl_clang_bootstrap_cfg}"',
'export LDFLAGS="${LDFLAGS} --config=${azl_clang_bootstrap_cfg}"',
]

[[components.llvm.overlays]]
description = "Bootstrap workaround: make the instrumented clang used by PGO perf training read the corrected Azure Linux GCC triple config; use a trap so the real clang is restored even if generate-profdata fails"
type = "spec-search-replace"
section = "%build"
regex = '%cmake_build --target generate-profdata'
replacement = '''# AZL bootstrap workaround for PGO perf training with the just-built clang
mv %{builddir_instrumented}/bin/clang %{builddir_instrumented}/bin/clang.real
cat > %{builddir_instrumented}/bin/clang <<EOF
#!/bin/sh
exec "\$(dirname "\$0")/clang.real" --config="${azl_clang_bootstrap_cfg}" "\$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
trap 'mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang 2>/dev/null || true' EXIT
%cmake_build --target generate-profdata
trap - EXIT
mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang'''
41 changes: 41 additions & 0 deletions base/comps/llvm20/llvm20.comp.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
[components.llvm20]

# Workaround: OpenMP tests fail in systemd-nspawn mock (95% failure rate)
# due to missing /proc/sys/kernel tunables and cgroup support for threads/forks.
build.without = ["mlir", "check"]

[[components.llvm20.overlays]]
description = "Use the Azure Linux GCC toolchain triple in clang20's default config so clang20 can find gcc runtime files in stage2 builds"
type = "spec-search-replace"
regex = '%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux'
replacement = '%global cfg_file_content --gcc-triple=%{_target_cpu}-%{_vendor}-linux'

[[components.llvm20.overlays]]
description = "Bootstrap workaround: write a clang config with the corrected --gcc-triple under %{_builddir} and inject it into CFLAGS/CXXFLAGS/LDFLAGS so this build's clang20 invocations override the chroot's stale default config (Koji stage2 still ships the broken clang20)"
type = "spec-prepend-lines"
section = "%build"
lines = [
"# AZL bootstrap workaround for llvm20 self-rebuild (see llvm20.comp.toml)",
'azl_clang_bootstrap_cfg="%{_builddir}/azl-clang-bootstrap.cfg"',
'echo "--gcc-triple=%{_target_cpu}-%{_vendor}-linux" > "${azl_clang_bootstrap_cfg}"',
'export CFLAGS="${CFLAGS} --config=${azl_clang_bootstrap_cfg}"',
'export CXXFLAGS="${CXXFLAGS} --config=${azl_clang_bootstrap_cfg}"',
'export LDFLAGS="${LDFLAGS} --config=${azl_clang_bootstrap_cfg}"',
]

[[components.llvm20.overlays]]
description = "Bootstrap workaround: make the instrumented clang used by PGO perf training read the corrected Azure Linux GCC triple config; use a trap so the real clang is restored even if generate-profdata fails"
type = "spec-search-replace"
section = "%build"
regex = '%cmake_build --target generate-profdata'
replacement = '''# AZL bootstrap workaround for PGO perf training with the just-built clang
mv %{builddir_instrumented}/bin/clang %{builddir_instrumented}/bin/clang.real
cat > %{builddir_instrumented}/bin/clang <<EOF
#!/bin/sh
exec "\$(dirname "\$0")/clang.real" --config="${azl_clang_bootstrap_cfg}" "\$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
trap 'mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang 2>/dev/null || true' EXIT
%cmake_build --target generate-profdata
trap - EXIT
mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang'''
2 changes: 1 addition & 1 deletion locks/llvm.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version = 1
import-commit = '659c0740e5c29098632207467aa89ce0083d5892'
upstream-commit = '659c0740e5c29098632207467aa89ce0083d5892'
input-fingerprint = 'sha256:22b9f82e2af24b7f06d921f74ac4b076e3ede06d26b66233acaad35a36c342c3'
input-fingerprint = 'sha256:be72647ff25aabfb7788e075f259d88f47b028b081caf9976e5bc86b1a692186'
resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e'
2 changes: 1 addition & 1 deletion locks/llvm20.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
version = 1
import-commit = '2cecf3d98071e54a6bfc29d9656698c89a07a535'
upstream-commit = '2cecf3d98071e54a6bfc29d9656698c89a07a535'
input-fingerprint = 'sha256:b355b2d8889f156e6c50ccad53ade7e9a6c133e333aeade2921c2291d3e56859'
input-fingerprint = 'sha256:8efce0c7b3c7b0b6d71e0ea40ba98504984cf746aa954c601dfea7fbf529c749'
resolution-input-hash = 'sha256:466421704711c4fd3c71f0b2ed715a0e61d49e3e26f3a2637fee755795849c8e'
1 change: 1 addition & 0 deletions specs/l/llvm/llvm.azl.macros
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Macros file automatically generated by azldev.
# Do not edit manually; changes will be overwritten.
%_without_check 1
%_without_mlir 1
23 changes: 21 additions & 2 deletions specs/l/llvm/llvm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## (rpmautospec version 0.8.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 5;
release_number = 6;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
Expand Down Expand Up @@ -1268,6 +1268,12 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt

#region build
%build
# AZL bootstrap workaround for llvm self-rebuild (see llvm.comp.toml)
azl_clang_bootstrap_cfg="%{_builddir}/azl-clang-bootstrap.cfg"
echo "--gcc-triple=%{_target_cpu}-%{_vendor}-linux" > "${azl_clang_bootstrap_cfg}"
export CFLAGS="${CFLAGS} --config=${azl_clang_bootstrap_cfg}"
export CXXFLAGS="${CXXFLAGS} --config=${azl_clang_bootstrap_cfg}"
export LDFLAGS="${LDFLAGS} --config=${azl_clang_bootstrap_cfg}"
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking.
%global reduce_debuginfo 0
Expand Down Expand Up @@ -1310,7 +1316,7 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt
%global runtimes %{runtimes};offload
%endif

%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux
%global cfg_file_content --gcc-triple=%{_target_cpu}-%{_vendor}-linux

# We want to use DWARF-5 on all snapshot builds.
%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10
Expand Down Expand Up @@ -1677,7 +1683,17 @@ fi
#endregion Instrument LLVM

#region Perf training
# AZL bootstrap workaround for PGO perf training with the just-built clang
mv %{builddir_instrumented}/bin/clang %{builddir_instrumented}/bin/clang.real
cat > %{builddir_instrumented}/bin/clang <<EOF
#!/bin/sh
exec "\$(dirname "\$0")/clang.real" --config="${azl_clang_bootstrap_cfg}" "\$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
trap 'mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang 2>/dev/null || true' EXIT
%cmake_build --target generate-profdata
trap - EXIT
mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang

# Show top 10 functions in the profile
llvm-profdata show --topn=10 %{builddir_instrumented}/tools/clang/utils/perf-training/clang.profdata | llvm-cxxfilt
Expand Down Expand Up @@ -3514,6 +3530,9 @@ fi

%changelog
## START: Generated by rpmautospec
* Sun May 10 2026 Rachel Menge <rachelmenge@microsoft.com> - 21.1.8-6
- fix(llvm,llvm20): correct clang GCC triple for Azure Linux stage2

* Thu Apr 30 2026 Daniel McIlvaney <damcilva@microsoft.com> - 21.1.8-5
- feat: introduce deterministic commit resolution via Azure Linux lock file

Expand Down
4 changes: 4 additions & 0 deletions specs/l/llvm20/llvm20.azl.macros
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Macros file automatically generated by azldev.
# Do not edit manually; changes will be overwritten.
%_without_check 1
%_without_mlir 1
27 changes: 25 additions & 2 deletions specs/l/llvm20/llvm20.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
## (rpmautospec version 0.8.3)
## RPMAUTOSPEC: autorelease, autochangelog
%define autorelease(e:s:pb:n) %{?-p:0.}%{lua:
release_number = 3;
release_number = 4;
base_release_number = tonumber(rpm.expand("%{?-b*}%{!?-b:1}"));
print(release_number + base_release_number - 1);
}%{?-e:.%{-e*}}%{?-s:.%{-s*}}%{!?-n:%{?dist}}
Expand All @@ -11,6 +11,9 @@
# This spec file has been modified by azldev to include build configuration overlays.
# Do not edit manually; changes may be overwritten.

# All Azure Linux specs with overlays include this macro file, irrespective of whether new macros have been added.
%{load:%{_sourcedir}/llvm20.azl.macros}

#region globals
#region version
%global maj_ver 20
Expand Down Expand Up @@ -373,6 +376,7 @@ Source1000: version.spec.inc

# Only used on RHEL-8, where rpmautospec is not available.
Source1001: changelog
Source9999: llvm20.azl.macros

# We've established the habit of numbering patches the following way:
#
Expand Down Expand Up @@ -1260,6 +1264,12 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt

#region build
%build
# AZL bootstrap workaround for llvm20 self-rebuild (see llvm20.comp.toml)
azl_clang_bootstrap_cfg="%{_builddir}/azl-clang-bootstrap.cfg"
echo "--gcc-triple=%{_target_cpu}-%{_vendor}-linux" > "${azl_clang_bootstrap_cfg}"
export CFLAGS="${CFLAGS} --config=${azl_clang_bootstrap_cfg}"
export CXXFLAGS="${CXXFLAGS} --config=${azl_clang_bootstrap_cfg}"
export LDFLAGS="${LDFLAGS} --config=${azl_clang_bootstrap_cfg}"
# TODO(kkleine): In clang we had this %ifarch s390 s390x aarch64 %ix86 ppc64le
# Decrease debuginfo verbosity to reduce memory consumption during final library linking.
%global reduce_debuginfo 0
Expand Down Expand Up @@ -1302,7 +1312,7 @@ sed -i 's/LLDB_ENABLE_PYTHON/TRUE/' lldb/docs/CMakeLists.txt
%global runtimes %{runtimes};offload
%endif

%global cfg_file_content --gcc-triple=%{_target_cpu}-redhat-linux
%global cfg_file_content --gcc-triple=%{_target_cpu}-%{_vendor}-linux

# We want to use DWARF-5 on all snapshot builds.
%if %{without snapshot_build} && %{defined rhel} && 0%{?rhel} < 10
Expand Down Expand Up @@ -1672,7 +1682,17 @@ fi
export LD_LIBRARY_PATH="%{builddir_instrumented}/%{_lib}:%{builddir_instrumented}/lib:$OLD_LD_LIBRARY_PATH"
export PATH="%{builddir_instrumented}/bin:$OLD_PATH"

# AZL bootstrap workaround for PGO perf training with the just-built clang
mv %{builddir_instrumented}/bin/clang %{builddir_instrumented}/bin/clang.real
cat > %{builddir_instrumented}/bin/clang <<EOF
#!/bin/sh
exec "\$(dirname "\$0")/clang.real" --config="${azl_clang_bootstrap_cfg}" "\$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
trap 'mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang 2>/dev/null || true' EXIT
%cmake_build --target generate-profdata
trap - EXIT
mv -f %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang

# Use the newly compiled llvm-profdata to avoid profile version mismatches like:
# "raw profile version mismatch: Profile uses raw profile format version = 10; expected version = 9"
Expand Down Expand Up @@ -3514,6 +3534,9 @@ fi

%changelog
## START: Generated by rpmautospec
* Sun May 10 2026 Rachel Menge <rachelmenge@microsoft.com> - 20.1.8-4
- fix(llvm,llvm20): correct clang GCC triple for Azure Linux stage2

* Thu Apr 30 2026 Daniel McIlvaney <damcilva@microsoft.com> - 20.1.8-3
- feat: introduce deterministic commit resolution via Azure Linux lock file

Expand Down
Loading