[PATCH dwarves] CI: support building kernel with LLVM
Alan Maguire <[email protected]> Mon, 23 Mar 2026 13:05:03 +0000
| Newsgroups | org.kernel.vger.dwarves |
|---|---|
| Message-ID | <[email protected]> |
Since LLVM true signature work will change function list, have method to build kernel/compare functions for LLVM. Example run here: https://github.com/alan-maguire/dwarves/actions/runs/23435796365/job/68173414313 Signed-off-by: Alan Maguire <[email protected]> --- .github/scripts/build-kernel.sh | 12 ++++++++++-- .github/scripts/build-pahole.sh | 2 ++ .github/scripts/compare-functions.sh | 12 ++++++++++-- .github/workflows/test.yml | 9 +++++++++ .github/workflows/vmtest.yml | 16 +++++++++++++++- 5 files changed, 46 insertions(+), 5 deletions(-) diff --git a/.github/scripts/build-kernel.sh b/.github/scripts/build-kernel.sh index 504c249..0a1fd3f 100755 --- a/.github/scripts/build-kernel.sh +++ b/.github/scripts/build-kernel.sh @@ -9,6 +9,8 @@ INPUTS_ARCH=${INPUTS_ARCH:-$(uname -m)} REPO=${REPO:-https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git} REPO_BRANCH=${REPO_BRANCH:-master} REPO_TARGET=${GITHUB_WORKSPACE}/.kernel +CC=${CC:-gcc} +LLVM_VERSION=${LLVM_VERSION:-18} export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH} export PAHOLE=${GITHUB_WORKSPACE}/install/usr/local/bin/pahole @@ -22,13 +24,19 @@ fi cd $REPO_TARGET git checkout $REPO_BRANCH +buildopts= +if [[ "$CC" = "clang" ]]; then + buildopts="LLVM=-${LLVM_VERSION}" + echo "Building with $buildopts" +fi + cat tools/testing/selftests/bpf/config \ tools/testing/selftests/bpf/config.${INPUTS_ARCH} > .config # this file might or might not exist depending on kernel version if [[ -f tools/testing/selftests/bpf/config.vm ]]; then cat tools/testing/selftests/bpf/config.vm >> .config fi -make olddefconfig && make prepare +make $buildopts olddefconfig && make prepare cat .config -make -j $((4*$(nproc))) all +make -j $((4*$(nproc))) $buildopts all diff --git a/.github/scripts/build-pahole.sh b/.github/scripts/build-pahole.sh index 7a37771..4f4013f 100755 --- a/.github/scripts/build-pahole.sh +++ b/.github/scripts/build-pahole.sh @@ -11,6 +11,7 @@ function restore() { GITHUB_WORKSPACE=${GITHUB_WORKSPACE:-$(dirname $0)/../..} BASELINE=${BASELINE:-next} +CC=${CC:-gcc} cd $GITHUB_WORKSPACE git log --oneline -1 @@ -19,6 +20,7 @@ git submodule update --init mkdir -p build cd build pwd + cmake -DGIT_SUBMODULE=OFF -DBUILD_SHARED_LIBS=OFF .. make -j$((4*$(nproc))) all make DESTDIR=../install install diff --git a/.github/scripts/compare-functions.sh b/.github/scripts/compare-functions.sh index cbe6596..48fc086 100755 --- a/.github/scripts/compare-functions.sh +++ b/.github/scripts/compare-functions.sh @@ -9,10 +9,18 @@ REPO_TARGET=${GITHUB_WORKSPACE}/.kernel VMLINUX=${GITHUB_WORKSPACE}/.kernel/vmlinux BASELINE=${BASELINE:-next} GITHUB_STEP_SUMMARY=${GITHUB_STEP_SUMMARY:-/dev/null} +CC=${CC:-gcc} +LLVM_VERSION=${LLVM_VERSION:-18} export PATH=${GITHUB_WORKSPACE}/install/usr/local/bin:${PATH} which pahole pahole --version + +buildopts= +if [[ "$CC" = "clang" ]]; then + buildopts="LLVM=-${LLVM_VERSION}" +fi + cd $REPO_TARGET pfunct --all --format_path=btf $VMLINUX > functions @@ -23,8 +31,8 @@ export PATH=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin:${PATH} export PAHOLE=${GITHUB_WORKSPACE}/install.${BASELINE}/usr/local/bin/pahole which pahole pahole --version -make oldconfig -make -j $((4*$(nproc))) all +make $buildopts oldconfig +make -j $((4*$(nproc))) $buildopts all pfunct --all --format_path=btf $VMLINUX > functions.${BASELINE} echo "### Compare vmlinux BTF functions generated with this change vs baseline (none means no differences)." | tee -a $GITHUB_STEP_SUMMARY diff functions.${BASELINE} functions | tee -a $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ac28e92..f47cc4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,11 +21,19 @@ jobs: arch: 'x86_64' llvm-version: '18' pahole: 'none' + cc: 'gcc' + - kernel: 'LATEST' + runs_on: 'ubuntu-24.04' + arch: 'x86_64' + llvm-version: '18' + pahole: 'none' + cc: 'clang' - kernel: 'LATEST' runs_on: 'ubuntu-24.04-arm' arch: 'aarch64' llvm-version: '18' pahole: 'none' + cc: 'gcc' name: Linux ${{ matrix.kernel }} uses: ./.github/workflows/vmtest.yml with: @@ -34,3 +42,4 @@ jobs: arch: ${{ matrix.arch }} llvm-version: ${{ matrix.llvm-version }} pahole: ${{ matrix.pahole }} + cc: ${{ matrix.cc }} diff --git a/.github/workflows/vmtest.yml b/.github/workflows/vmtest.yml index 54bb92e..147b608 100644 --- a/.github/workflows/vmtest.yml +++ b/.github/workflows/vmtest.yml @@ -27,9 +27,14 @@ on: required: false default: '18' type: string + cc: + description: 'compiler' + required: true + type: string + jobs: vmtest: - name: pahole@${{ inputs.arch }} + name: pahole-${{ inputs.cc }}@${{ inputs.arch }} runs-on: ${{ inputs.runs_on }} steps: @@ -44,6 +49,9 @@ jobs: - name: Build,install current pahole shell: bash + env: + CC: ${{ inputs.cc }} + LLVM_VERSION: ${{ inputs.llvm-version}} run: .github/scripts/build-pahole.sh - name: Get kernel source @@ -54,6 +62,9 @@ jobs: - name: Configure, build kernel with current pahole shell: bash + env: + CC: ${{ inputs.cc }} + LLVM_VERSION: ${{ inputs.llvm-version }} run: .github/scripts/build-kernel.sh - name: Run selftests @@ -62,5 +73,8 @@ jobs: - name: Compare functions generated shell: bash + env: + CC: ${{ inputs.cc }} + LLVM_VERSION: ${{ inputs.llvm_version }} run: .github/scripts/compare-functions.sh -- 2.43.5