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
20 changes: 18 additions & 2 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-22.04]
os: [ubuntu-22.04, ubuntu-24.04]
runs-on: ${{ matrix.os }}
env:
FEATURES: .llvm and .skeletons
Expand All @@ -45,6 +45,11 @@ jobs:
--slave /usr/bin/llvm-strip llvm-strip /usr/bin/llvm-strip-"${CLANG_VERSION}"
echo "CLANG_VERSION=${CLANG_VERSION}" >> "${GITHUB_ENV}"

- name: Install libsframe (Ubuntu 24.04+)
if: matrix.os == 'ubuntu-20.04'
run: |
sudo apt-get install -y libsframe1

- name: Build bpftool (default LLVM disassembler)
run: |
make -j -C src V=1
Expand Down Expand Up @@ -75,7 +80,18 @@ jobs:
- name: Build bpftool, with libbfd, static build
run: |
make -C src clean
EXTRA_LDFLAGS=-static make -j -C src V=1
if [[ "${{ matrix.os }}" == "ubuntu-24.04" ]]; then
# FIXME - See #73
echo "... building bootstrap bpftool"
EXTRA_LDFLAGS=-static make -j -C src V=1 \
LIBS="./bootstrap/libbpf/libbpf.a -lelf -lz -lzstd -lcap -lbfd -ldl -liberty -lz -lzstd -lsframe -lopcodes" \
bootstrap
echo "... building main bpftool binary"
EXTRA_LDFLAGS=-static make -j -C src V=1 \
LIBS="./libbpf/libbpf.a -lelf -lz -lzstd -lcap -lbfd -ldl -liberty -lz -lzstd -lsframe -lopcodes"
else
EXTRA_LDFLAGS=-static make -j -C src V=1
fi
./src/bpftool 2>&1 | grep -q Usage
./src/bpftool -p version | \
tee /dev/stderr | \
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# hadolint global ignore=DL3008

FROM ubuntu:22.04 as builder
FROM ubuntu:22.04 AS builder

RUN \
export DEBIAN_FRONTEND=noninteractive && \
Expand Down
27 changes: 25 additions & 2 deletions src/Makefile.feature
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,28 @@ 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 <libelf.h>\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 - $(LDFLAGS) -lelf -lz -lzstd \
-o /dev/null >/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)),)
Expand Down Expand Up @@ -79,7 +101,8 @@ DISASSEMBLER_PROBE += ' return 0;'
DISASSEMBLER_PROBE += '}'

DISASSEMBLER_PROBE_CMD = printf '%b\n' $(1) | \
$(CC) $(CFLAGS) -Wall -Werror -x c -DPACKAGE='"bpftool"' - $(LDFLAGS) -lbfd -lopcodes -S -o - >/dev/null
$(CC) $(CFLAGS) -Wall -Werror -x c -DPACKAGE='"bpftool"' - $(LDFLAGS) -lbfd -lopcodes -S \
-o /dev/null >/dev/null
define disassembler_build
$(call detect,$(DISASSEMBLER_PROBE_CMD))
endef
Expand Down Expand Up @@ -112,7 +135,7 @@ LIBCAP_PROBE += ' cap_free(0);'
LIBCAP_PROBE += ' return 0;'
LIBCAP_PROBE += '}'
LIBCAP_PROBE_CMD = printf '%b\n' $(LIBCAP_PROBE) | \
$(CC) $(CFLAGS) -Wall -Werror -x c - $(LDFLAGS) -lcap -S -o - >/dev/null
$(CC) $(CFLAGS) -Wall -Werror -x c - $(LDFLAGS) -lcap -S -o /dev/null >/dev/null

define libcap_build
$(call detect,$(LIBCAP_PROBE_CMD))
Expand Down
Loading