From 662864e8b263560c2ca09f250acec403636d5518 Mon Sep 17 00:00:00 2001 From: Jeffrey <106184818+c0d33ngr@users.noreply.github.com> Date: Wed, 15 Jan 2025 08:32:55 +0100 Subject: [PATCH 1/5] ci: Update build.yaml to include Ubuntu 24.04 Signed-off-by: Jeffrey --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9059365f..d09a4d9a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04] + os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] runs-on: ${{ matrix.os }} env: FEATURES: .llvm and .skeletons From 368a1a559141b8819f876dcf69eb7381b9decef7 Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Tue, 25 Feb 2025 10:07:55 +0000 Subject: [PATCH 2/5] ci: Remove deprecated Ubuntu 20.04 from runners The Ubuntu 20.04-based runners have been deprecated by GitHub at the beginning of this month, and are expected to go fully unsupported by 2025-04-01. Let's remove it from the workflow file. Link: https://github.com/actions/runner-images/issues/11101 Signed-off-by: Quentin Monnet --- .github/workflows/build.yaml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index d09a4d9a..534f0c4a 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -21,7 +21,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04, ubuntu-22.04, ubuntu-24.04] + os: [ubuntu-22.04, ubuntu-24.04] runs-on: ${{ matrix.os }} env: FEATURES: .llvm and .skeletons @@ -32,12 +32,6 @@ jobs: with: submodules: true - - name: Use clang-12 and not clang-11 for older Ubuntu - if: matrix.os == 'ubuntu-20.04' - run: | - sudo apt-get remove -y clang-11 llvm-11 - sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-12 50 - - name: Install dependencies run: | sudo apt-get update From 3b812c24d8372d627dddd3f8ab59fa19aa984b8a Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Tue, 25 Feb 2025 10:53:42 +0000 Subject: [PATCH 3/5] mirror: Add probe for libelf-zstd feature Add the probe to test whether we need to link against the zstd library to use libelf in bpftool. This should ideally have been merged before commit 67f1758bd788 ("bpftool: Link zstd lib required by libelf"), where we have the Makefile use the actual feature, but I forgot to add the probe when synchronising the repository. Elfutils commit a5b07cdf9c49 adds support for ZSTD compression, first shipped with elfutils 0.189. Distros now have it; for example, Ubuntu 22.04 ships version 0.186 (or 0.188 in backports), but Ubuntu 24.04 has 0.189 or 0.190 depending on the arch. Link: https://sourceware.org/git/?p=elfutils.git;a=commit;h=a5b07cdf9c491fb7a4a16598c482c68b718f59b9 Signed-off-by: Quentin Monnet --- src/Makefile.feature | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/src/Makefile.feature b/src/Makefile.feature index b08e7b90..d16e8a46 100644 --- a/src/Makefile.feature +++ b/src/Makefile.feature @@ -34,9 +34,41 @@ feature-clang-bpf-co-re := \ $(findstring 1,$(call detect,$(CLANG_BPF_CO_RE_PROBE_CMD))) endif # clang-bpf-co-re +### feature-libelf-zstd + +# Define these unconditionally so we can also use the probe for feature-libbfd +LIBELF_ZSTD_PROBE := '$(pound)include \n' +LIBELF_ZSTD_PROBE += 'int main(void) {' +LIBELF_ZSTD_PROBE += ' elf_compress(0, ELFCOMPRESS_ZSTD, 0);' +LIBELF_ZSTD_PROBE += ' return 0;' +LIBELF_ZSTD_PROBE += '}' + +LIBELF_ZSTD_PROBE_CMD = printf '%b\n' $(LIBELF_ZSTD_PROBE) | \ + $(CC) $(CFLAGS) -Wall -Werror -x c - -lelf -lz -lzstd -o - >/dev/null + +define libelf_zstd_build + $(call detect,$(LIBELF_ZSTD_PROBE_CMD)) +endef + +ifneq ($(findstring libelf-zstd,$(FEATURE_TESTS)),) +$(call LOG,Probing: feature-libelf-zstd) +feature-libelf-zstd := $(findstring 1, $(call libelf_zstd_build)) +endif # libelf-zstd + ### feature-libbfd ifneq ($(findstring libbfd,$(FEATURE_TESTS)),) + +# Check whether feature-libbfd probe needs libzstd +ifneq ($(findstring libelf-zstd,$(FEATURE_TESTS)),) + need_libzstd := $(feature-libelf-zstd) +else + need_libzstd := $(findstring 1, $(call libelf_zstd_build)) +endif +ifeq ($(need_libzstd),1) + LIBZSTD_FLAG := -lzstd +endif + LIBBFD_PROBE := '$(pound)include \n' LIBBFD_PROBE += 'int main(void) {' LIBBFD_PROBE += ' bfd_demangle(0, 0, 0);' @@ -51,15 +83,15 @@ endef $(call LOG,Probing: feature-libbfd) feature-libbfd := \ - $(findstring 1,$(call libbfd_build,-lbfd -ldl)) + $(findstring 1,$(call libbfd_build,-lbfd $(LIBZSTD_FLAG) -ldl)) ifneq ($(feature-libbfd),1) $(call LOG,Probing: feature-libbfd-liberty) feature-libbfd-liberty := \ - $(findstring 1,$(call libbfd_build,-lbfd -ldl -liberty)) + $(findstring 1,$(call libbfd_build,-lbfd $(LIBZSTD_FLAG) -ldl -liberty)) ifneq ($(feature-libbfd-liberty),1) $(call LOG,Probing: feature-libbfd-liberty-z) feature-libbfd-liberty-z := \ - $(findstring 1,$(call libbfd_build,-lbfd -ldl -liberty -lz)) + $(findstring 1,$(call libbfd_build,-lbfd $(LIBZSTD_FLAG) -ldl -liberty -lz)) endif endif HAS_LIBBFD := $(findstring 1, \ From 1a88cf7043c9e51e144142325d85ea77bec52e83 Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Tue, 25 Feb 2025 11:37:49 +0000 Subject: [PATCH 4/5] mirror: test Signed-off-by: Quentin Monnet --- .github/workflows/build.yaml | 2 ++ src/Makefile | 3 +++ src/Makefile.feature | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 534f0c4a..ca899ca7 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -37,6 +37,8 @@ jobs: sudo apt-get update sudo apt-get install -y \ libbfd-dev libcap-dev libelf-dev libiberty-dev python3-docutils + # Install libsframe1 on Ubuntu 24.04+ + sudo apt install -y libsframe1 || true # clang/LLVM are already installed, but we're missing some aliases. CLANG_VERSION="$(echo '__clang_major__' | clang -E - | tail -n 1)" sudo update-alternatives \ diff --git a/src/Makefile b/src/Makefile index 9305a863..4691840e 100644 --- a/src/Makefile +++ b/src/Makefile @@ -180,6 +180,9 @@ else ifeq ($(feature-disassembler-init-styled), 1) CFLAGS += -DDISASM_INIT_STYLED endif + ifeq ($(feature-libelf-zstd),1) + LIBS += -lsframe + endif endif endif ifeq ($(filter -DHAVE_LLVM_SUPPORT -DHAVE_LIBBFD_SUPPORT,$(CFLAGS)),) diff --git a/src/Makefile.feature b/src/Makefile.feature index d16e8a46..ae7574a8 100644 --- a/src/Makefile.feature +++ b/src/Makefile.feature @@ -66,7 +66,7 @@ else need_libzstd := $(findstring 1, $(call libelf_zstd_build)) endif ifeq ($(need_libzstd),1) - LIBZSTD_FLAG := -lzstd + LIBZSTD_FLAG := -lzstd -lsframe endif LIBBFD_PROBE := '$(pound)include \n' From 5b21d29453fa34ef09ba5511a79e2614241a9e8c Mon Sep 17 00:00:00 2001 From: Quentin Monnet Date: Tue, 25 Feb 2025 17:14:28 +0000 Subject: [PATCH 5/5] ci: Bump Ubuntu image on runners Use Ubuntu 24.04 instead of 22.04 (when we use a single version, not for the build test Matrix where we want to test both), except for the job where we package the release (where we're not really tied to a specific version and can just go with ubuntu-latest). Signed-off-by: Quentin Monnet --- .github/workflows/release.yaml | 6 +++--- .github/workflows/static-build.yaml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 69c00a49..5625e49f 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -18,7 +18,7 @@ env: jobs: build: name: Build static bpftool binary - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: TARGETARCH: ${{ matrix.arch }} FILE_STRING_ARCH_amd64: x86-64 @@ -33,7 +33,7 @@ jobs: if: matrix.arch == 'amd64' run: | sudo apt-get update - sudo apt-get install -y libelf-dev libcap-dev + sudo apt-get install -y libelf-dev libcap-dev libsframe1 - name: Download and extract compiled LLVM release env: @@ -111,7 +111,7 @@ jobs: draft-release: name: Create a draft release - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: build permissions: contents: write diff --git a/.github/workflows/static-build.yaml b/.github/workflows/static-build.yaml index 79411ce9..8b1baf58 100644 --- a/.github/workflows/static-build.yaml +++ b/.github/workflows/static-build.yaml @@ -17,7 +17,7 @@ concurrency: jobs: build: - runs-on: ubuntu-22.04 + runs-on: ubuntu-24.04 env: LLVM_URL_PREFIX: https://github.com/llvm/llvm-project/releases/download/llvmorg-15.0.0 LLVM_PATH: clang+llvm-15.0.0-x86_64-linux-gnu-rhel-8.4 @@ -26,7 +26,7 @@ jobs: - name: Install dependencies run: | sudo apt-get update - sudo apt-get install -y libelf-dev + sudo apt-get install -y libelf-dev libsframe1 - name: Download and extract compiled LLVM release run: |