Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tetragon: Switch to clang-14 #397

Merged
merged 4 commits into from
Nov 7, 2022
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
10 changes: 6 additions & 4 deletions Dockerfile.clang
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
FROM ubuntu:22.04@sha256:34fea4f31bf187bc915536831fd0afc9d214755bf700b5cdb1336c82516d154e
ARG VERSION=1:13.0.1-2ubuntu2
ARG VERSION=1:14.0.0-1ubuntu1
RUN apt-get update
RUN apt-get -y upgrade
RUN apt-get install -y --no-install-recommends clang-13=$VERSION libclang-common-13-dev=$VERSION libclang-cpp13=$VERSION libllvm13=$VERSION llvm-13-linker-tools=$VERSION libclang1-13=$VERSION llvm-13=$VERSION llvm-13-runtime=$VERSION llvm-13-linker-tools=$VERSION make
RUN ln -vsnf /usr/lib/llvm-13/bin/clang /usr/bin/clang
RUN ln -vsnf /usr/lib/llvm-13/bin/llc /usr/bin/llc
RUN apt-cache search clang
RUN apt show clang-14
RUN apt-get install -y --no-install-recommends clang-14=$VERSION libclang-common-14-dev=$VERSION libclang-cpp14=$VERSION libllvm14=$VERSION llvm-14-linker-tools=$VERSION libclang1-14=$VERSION llvm-14=$VERSION llvm-14-runtime=$VERSION llvm-14-linker-tools=$VERSION make
RUN ln -vsnf /usr/lib/llvm-14/bin/clang /usr/bin/clang
RUN ln -vsnf /usr/lib/llvm-14/bin/llc /usr/bin/llc
RUN apt-get clean
RUN rm -rf /var/lib/apt/lists/*
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ LOCAL_CLANG ?= 0
LOCAL_CLANG_FORMAT ?= 0
FORMAT_FIND_FLAGS ?= -name '*.c' -o -name '*.h' -not -path 'bpf/include/vmlinux.h' -not -path 'bpf/include/api.h' -not -path 'bpf/libbpf/*'
NOOPT ?= 0
CLANG_IMAGE = quay.io/cilium/clang:7ea8dd5b610a8864ce7b56e10ffeb61030a0c50e@sha256:02ad7cc1d08d85c027557099b88856945be5124b5c31aeabce326e7983e3913b
CLANG_IMAGE = quay.io/cilium/clang:ca424d14eb4326ffc65fccd8049d8a7bfdd06607@sha256:be37c932add0b5f22edd72da3af4ccc4df6dbd54e6e99424fa5190bafc10e55f
TESTER_PROGS_DIR = "contrib/tester-progs"
# Extra flags to pass to test binary
EXTRA_TESTFLAGS ?=
Expand Down Expand Up @@ -212,7 +212,7 @@ image-codegen:

.PHONY: image-clang
image-clang:
$(CONTAINER_ENGINE) build -f Dockerfile.clang --build-arg VERSION=1:13.0.1-2ubuntu2 -t "cilium/clang:${DOCKER_IMAGE_TAG}" .
$(CONTAINER_ENGINE) build -f Dockerfile.clang --build-arg VERSION=1:14.0.0-1ubuntu1 -t "cilium/clang:${DOCKER_IMAGE_TAG}" .
$(QUIET)echo "Push like this when ready:"
$(QUIET)echo "${CONTAINER_ENGINE} push cilium/clang:$(DOCKER_IMAGE_TAG)"

Expand Down
2 changes: 1 addition & 1 deletion bpf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ FLAGS := -I. \
-Wno-address-of-packed-member -Wno-compare-distinct-pointer-types -Wno-unknown-warning-option \
-O2

CLANG_FLAGS += $(FLAGS) -I $(LIBBPF) -I $(IDIR) -I $(LDIR) -target bpf -emit-llvm -g -D__TARGET_ARCH_$(ARCH)
CLANG_FLAGS += $(FLAGS) -I $(LIBBPF) -I $(IDIR) -I $(LDIR) -target bpf -emit-llvm -g -D__TARGET_ARCH_$(ARCH) -fdebug-default-version=4
LLC_FLAGS := -march=bpf -mcpu=v2 -mattr=dwarfris
LLC_FLAGS_ALU32 := -march=bpf -mcpu=v3 -mattr=dwarfris

Expand Down
2 changes: 2 additions & 0 deletions bpf/process/bpf_process_event.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,8 @@ prepend_path(const struct path *path, const struct path *root, char *bf,

#ifndef __LARGE_BPF_PROG
#pragma unroll
#else
#pragma nounroll
#endif
for (i = 0; i < PROBE_CWD_READ_ITERATIONS;
++i) { // maximum number of path compoments
Expand Down