diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9059365f..ca899ca7 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-22.04, ubuntu-24.04] runs-on: ${{ matrix.os }} env: FEATURES: .llvm and .skeletons @@ -32,17 +32,13 @@ 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 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/.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: | 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 b08e7b90..ae7574a8 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 -lsframe +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, \