Skip to content
Draft
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
44 changes: 41 additions & 3 deletions base/comps/kernel/kernel.comp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@
# Release: %{pkg_release}
release = { calculation = "manual" }

# Skip debug kernel variant to reduce build time
# Skip debug kernel variant to reduce build time.
[components.kernel.build]
without = ["debug"]
without = [
"debug",
]

[components.kernel.build.defines]
# RPM release number for the Azure Linux kernel package
azl_pkgrelease = "8"
azl_pkgrelease = "10"
# 4th version component from the AZL kernel source (6.18.5.1). Included in specrelease so it appears
# in the RPM Release tag, uname -r, and /lib/modules/ path (e.g. 6.18.5-1.3.azl4.aarch64).
kextraversion = "1"
Expand Down Expand Up @@ -153,3 +155,39 @@ lines = [
"cd ../..",
"%endif",
]

# Selftests build fix for Azure Linux's restricted build chroot.
# This overlay patches the kernel source tree at the end of %prep (so it runs
# AFTER any patch application). Without it, the kernel-selftests-internal RPM is
# missing test_progs and test_progs-no_alu32, because their BPF light-skeleton
# generation step fails silently and the spec tolerates the misses with
# `cp ... || true`.

[[components.kernel.overlays]]
description = "Drop the BPF light-skeleton variant of test_ksyms_weak. `bpftool gen object` runs the BPF program through libbpf which probes /proc/kallsyms to resolve weak ksym references; mock's systemd-nspawn chroot blocks /proc/kallsyms (EACCES) so `*.lskel.h` generation fails and breaks the test_progs / test_progs-no_alu32 link. Removing test_ksyms_weak.c from LSKELS_EXTRA and dropping the matching subtest in prog_tests/ksyms_btf.c mirrors the upstream Fedora fix `selftests/bpf: Remove ksyms_weak_lskel test` by Artem Savkov."
type = "spec-append-lines"
section = "%prep"
lines = [
'%{log_msg "AZL: drop BPF lskel variant of test_ksyms_weak"}',
"pushd linux-%{KVERREL}/tools/testing/selftests/bpf",
"# Remove test_ksyms_weak.c from the LSKELS_EXTRA list so no .lskel.h is generated for it.",
"sed -i 's| test_ksyms_weak\\.c||' Makefile",
"# Drop the lskel-variant subtest from prog_tests/ksyms_btf.c so the file still compiles",
"# without test_ksyms_weak.lskel.h.",
"sed -i '/^#include \"test_ksyms_weak\\.lskel\\.h\"$/d' prog_tests/ksyms_btf.c",
"sed -i '/^static void test_weak_syms_lskel/,/^}$/d' prog_tests/ksyms_btf.c",
"sed -i '/test__start_subtest(\"weak_ksyms_lskel\")/,/test_weak_syms_lskel();/d' prog_tests/ksyms_btf.c",
"popd",
]

[[components.kernel.overlays]]
description = "Compile kselftests with -fPIE so they can be linked with the hardened toolchain's default -pie. Many kselftests (timens/, exec/, firmware/, mount/, vDSO/, ...) reset CFLAGS via `CFLAGS := ...` in their per-test Makefile, which drops the EXTRA_CFLAGS that kernel.spec passes in (so -fPIE from redhat-hardened-cc1 is lost). Selftests' lib.mk re-appends $(USERCFLAGS) AFTER the per-test reset, so passing USERCFLAGS=-fPIE on the make line restores -fPIE for every selftest target. Without this, dozens of selftest binaries fail to link with `relocation R_X86_64_32 ... can not be used when making a PIE object` and silently get omitted from kernel-selftests-internal."
type = "spec-search-replace"
regex = 'EXTRA_LDFLAGS="%\{__global_ldflags\}" ARCH=\$Arch V=1 TARGETS='
replacement = 'EXTRA_LDFLAGS="%{__global_ldflags}" USERCFLAGS="-fPIE" ARCH=$Arch V=1 TARGETS='

[[components.kernel.overlays]]
description = "Filter the bogus `Requires: /usr/bin/inc` auto-dependency from kernel-selftests-internal. The selftests `exec` test ships `script-exec.inc` and `script-noexec.inc` (copied verbatim from samples/check-exec/) with a `#!/usr/bin/env inc` shebang. RPM's shebang-based dep generator turns this into `Requires: /usr/bin/inc`, but the actual `inc` interpreter is shipped INSIDE this same package at `/usr/libexec/kselftests/exec/inc`, not in `/usr/bin/`. The dep is therefore unsatisfiable at install time and blocks images from including kernel-selftests-internal. Extends the existing `__requires_exclude` (which already filters `liburandom_read.so.*`) to also filter `/usr/bin/inc`. Note: this only manifests AFTER the USERCFLAGS=-fPIE overlay above, because before that the `inc` binary failed to link (PIE) and the `.inc` files weren't installed."
type = "spec-search-replace"
regex = '^%define __requires_exclude \^liburandom_read\.so\.\*\$$'
replacement = '%define __requires_exclude ^liburandom_read.so.*$|^/usr/bin/inc$'
33 changes: 33 additions & 0 deletions base/comps/llvm/llvm.comp.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,36 @@
# 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"]

[[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}-azurelinux-linux'

[[components.llvm.overlays]]
description = "Bootstrap workaround: write a clang config with the corrected --gcc-triple to /tmp 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)",
'echo "--gcc-triple=%{_target_cpu}-azurelinux-linux" > /tmp/azl-clang-bootstrap.cfg',
'export CFLAGS="${CFLAGS} --config=/tmp/azl-clang-bootstrap.cfg"',
'export CXXFLAGS="${CXXFLAGS} --config=/tmp/azl-clang-bootstrap.cfg"',
'export LDFLAGS="${LDFLAGS} --config=/tmp/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"
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=/tmp/azl-clang-bootstrap.cfg "$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
%cmake_build --target generate-profdata
mv %{builddir_instrumented}/bin/clang.real %{builddir_instrumented}/bin/clang'''
2 changes: 1 addition & 1 deletion locks/kernel.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
version = 1
import-commit = '5271a1b047ef402ddee40242e02eda23fc273044'
upstream-commit = '5271a1b047ef402ddee40242e02eda23fc273044'
input-fingerprint = 'sha256:17b1688189cad004cf195b09cca4ceae4c6e36477ec49bb6aea0443c04db6626'
input-fingerprint = 'sha256:4c3800ce4d392779b6658920b9543da72c8307f840546d8bf26cfd0c6059c1ca'
2 changes: 1 addition & 1 deletion specs/k/kernel/kernel.azl.macros
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Macros file automatically generated by azldev.
# Do not edit manually; changes will be overwritten.
%_without_debug 1
%azl_pkgrelease 8
%azl_pkgrelease 10
%azurelinux_version 3
%kextraversion 1
14 changes: 12 additions & 2 deletions specs/k/kernel/kernel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ Kernel sample programs and selftests.
# of matching the pattern against the symlinks file.
%{expand:%%global _find_debuginfo_opts %{?_find_debuginfo_opts} -p '.*%%{_libexecdir}/(ksamples|kselftests)/.*|XXX' -o selftests-debuginfo.list}

%define __requires_exclude ^liburandom_read.so.*$
%define __requires_exclude ^liburandom_read.so.*$|^/usr/bin/inc$

# with_selftests
%endif
Expand Down Expand Up @@ -2245,6 +2245,16 @@ OPTS="-w -n -c"
RHJOBS=$RPM_BUILD_NCPUS SPECPACKAGE_NAME=%{name} ./process_configs.sh $OPTS %{specrpmversion}
cd ../..
%endif
%{log_msg "AZL: drop BPF lskel variant of test_ksyms_weak"}
pushd linux-%{KVERREL}/tools/testing/selftests/bpf
# Remove test_ksyms_weak.c from the LSKELS_EXTRA list so no .lskel.h is generated for it.
sed -i 's| test_ksyms_weak\.c||' Makefile
# Drop the lskel-variant subtest from prog_tests/ksyms_btf.c so the file still compiles
# without test_ksyms_weak.lskel.h.
sed -i '/^#include "test_ksyms_weak\.lskel\.h"$/d' prog_tests/ksyms_btf.c
sed -i '/^static void test_weak_syms_lskel/,/^}$/d' prog_tests/ksyms_btf.c
sed -i '/test__start_subtest("weak_ksyms_lskel")/,/test_weak_syms_lskel();/d' prog_tests/ksyms_btf.c
popd
%build
%{log_msg "Start of build stage"}

Expand Down Expand Up @@ -3324,7 +3334,7 @@ pushd tools/testing/selftests
export CFLAGS="%{build_cflags}"
export CXXFLAGS="%{build_cxxflags}"

%{make} %{?_smp_mflags} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" ARCH=$Arch V=1 TARGETS="bpf cgroup kmod mm net net/can net/forwarding net/hsr net/mptcp net/netfilter net/packetdrill tc-testing memfd drivers/net drivers/net/hw iommu cachestat pid_namespace rlimits timens pidfd capabilities clone3 exec filesystems firmware landlock mount mount_setattr move_mount_set_group nsfs openat2 proc safesetid seccomp tmpfs uevent vDSO" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install
%{make} %{?_smp_mflags} EXTRA_CFLAGS="${RPM_OPT_FLAGS}" EXTRA_CXXFLAGS="${RPM_OPT_FLAGS}" EXTRA_LDFLAGS="%{__global_ldflags}" USERCFLAGS="-fPIE" ARCH=$Arch V=1 TARGETS="bpf cgroup kmod mm net net/can net/forwarding net/hsr net/mptcp net/netfilter net/packetdrill tc-testing memfd drivers/net drivers/net/hw iommu cachestat pid_namespace rlimits timens pidfd capabilities clone3 exec filesystems firmware landlock mount mount_setattr move_mount_set_group nsfs openat2 proc safesetid seccomp tmpfs uevent vDSO" SKIP_TARGETS="" $force_targets INSTALL_PATH=%{buildroot}%{_libexecdir}/kselftests VMLINUX_H="${RPM_VMLINUX_H}" install

# Restore the original level of source fortification
%define _fortify_level %{_fortify_level_bak}
Expand Down
20 changes: 19 additions & 1 deletion specs/l/llvm/llvm.spec
Original file line number Diff line number Diff line change
Expand Up @@ -1268,6 +1268,11 @@ 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)
echo "--gcc-triple=%{_target_cpu}-azurelinux-linux" > /tmp/azl-clang-bootstrap.cfg
export CFLAGS="${CFLAGS} --config=/tmp/azl-clang-bootstrap.cfg"
export CXXFLAGS="${CXXFLAGS} --config=/tmp/azl-clang-bootstrap.cfg"
export LDFLAGS="${LDFLAGS} --config=/tmp/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 +1315,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}-azurelinux-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 +1682,15 @@ 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=/tmp/azl-clang-bootstrap.cfg "$@"
EOF
chmod +x %{builddir_instrumented}/bin/clang
%cmake_build --target generate-profdata
mv %{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,8 +3527,13 @@ fi

%changelog
## START: Generated by rpmautospec
<<<<<<< HEAD
* Thu Apr 30 2026 Daniel McIlvaney <damcilva@microsoft.com> - 21.1.8-5
- feat: introduce deterministic commit resolution via Azure Linux lock file
=======
* Tue Apr 28 2026 azldev <azurelinux@microsoft.com> - 21.1.8-5
- Latest state for llvm
>>>>>>> 554641f25f (fix(llvm): correct clang's default GCC triple for Azure Linux stage2)

* Thu Jan 22 2026 Josh Stone <jistone@redhat.com> - 21.1.8-4
- Fix s390x vector miscompilation (rhbz#2430017)
Expand Down
Loading