python3Packages.orjson: Disable failing tests on 32 bit
[NixPkgs.git] / pkgs / tools / security / tracee / use-our-libbpf.patch
blob562bdb6e09f0028366ea80894da79ec4ff69ce05
1 diff --git a/Makefile b/Makefile
2 index c72cf63d..e96b7eed 100644
3 --- a/Makefile
4 +++ b/Makefile
5 @@ -50,6 +50,7 @@ CMD_STATICCHECK ?= staticcheck
6 # libs
9 +LIB_BPF ?= libbpf
10 LIB_ELF ?= libelf
11 LIB_ZLIB ?= zlib
13 @@ -172,10 +173,6 @@ env:
14 @echo "KERN_BUILD_PATH $(KERN_BUILD_PATH)"
15 @echo "KERN_SRC_PATH $(KERN_SRC_PATH)"
16 @echo ---------------------------------------
17 - @echo "LIBBPF_CFLAGS $(LIBBPF_CFLAGS)"
18 - @echo "LIBBPF_LDLAGS $(LIBBPF_LDFLAGS)"
19 - @echo "LIBBPF_SRC $(LIBBPF_SRC)"
20 - @echo ---------------------------------------
21 @echo "STATIC $(STATIC)"
22 @echo ---------------------------------------
23 @echo "BPF_VCPU $(BPF_VCPU)"
24 @@ -274,8 +271,6 @@ OUTPUT_DIR = ./dist
25 $(OUTPUT_DIR):
27 @$(CMD_MKDIR) -p $@
28 - @$(CMD_MKDIR) -p $@/libbpf
29 - @$(CMD_MKDIR) -p $@/libbpf/obj
32 # embedded btfhub
33 @@ -286,37 +281,6 @@ $(OUTPUT_DIR)/btfhub:
34 @$(CMD_MKDIR) -p $@
35 @$(CMD_TOUCH) $@/.place-holder # needed for embed.FS
38 -# libbpf
41 -LIBBPF_CFLAGS = "-fPIC"
42 -LIBBPF_LDLAGS =
43 -LIBBPF_SRC = ./3rdparty/libbpf/src
45 -$(OUTPUT_DIR)/libbpf/libbpf.a: \
46 - $(LIBBPF_SRC) \
47 - $(wildcard $(LIBBPF_SRC)/*.[ch]) \
48 - | .checkver_$(CMD_CLANG) $(OUTPUT_DIR)
50 - CC="$(CMD_CLANG)" \
51 - CFLAGS="$(LIBBPF_CFLAGS)" \
52 - LD_FLAGS="$(LIBBPF_LDFLAGS)" \
53 - $(MAKE) \
54 - -C $(LIBBPF_SRC) \
55 - BUILD_STATIC_ONLY=1 \
56 - DESTDIR=$(abspath ./$(OUTPUT_DIR)/libbpf/) \
57 - OBJDIR=$(abspath ./$(OUTPUT_DIR)/libbpf/obj) \
58 - INCLUDEDIR= LIBDIR= UAPIDIR= prefix= libdir= \
59 - install install_uapi_headers
61 -$(LIBBPF_SRC): \
62 - | .check_$(CMD_GIT)
64 -ifeq ($(wildcard $@), )
65 - @$(CMD_GIT) submodule update --init --recursive
66 -endif
69 # non co-re ebpf
71 @@ -333,7 +297,6 @@ BPF_NOCORE_TAG = $(subst .,_,$(KERN_RELEASE)).$(subst .,_,$(VERSION))
72 bpf-nocore: $(OUTPUT_DIR)/tracee.bpf.$(BPF_NOCORE_TAG).o
74 $(OUTPUT_DIR)/tracee.bpf.$(BPF_NOCORE_TAG).o: \
75 - $(OUTPUT_DIR)/libbpf/libbpf.a \
76 $(TRACEE_EBPF_OBJ_SRC)
78 MAKEFLAGS="--no-print-directory"
79 @@ -351,7 +314,6 @@ $(OUTPUT_DIR)/tracee.bpf.$(BPF_NOCORE_TAG).o: \
80 -I $(KERN_SRC_PATH)/include/uapi \
81 -I $(KERN_BUILD_PATH)/include/generated \
82 -I $(KERN_BUILD_PATH)/include/generated/uapi \
83 - -I $(OUTPUT_DIR)/libbpf \
84 -I ./3rdparty/include \
85 -Wunused \
86 -Wall \
87 @@ -412,7 +374,6 @@ TRACEE_EBPF_OBJ_CORE_HEADERS = $(shell find pkg/ebpf/c -name *.h)
88 bpf-core: $(OUTPUT_DIR)/tracee.bpf.core.o
90 $(OUTPUT_DIR)/tracee.bpf.core.o: \
91 - $(OUTPUT_DIR)/libbpf/libbpf.a \
92 $(TRACEE_EBPF_OBJ_SRC) \
93 $(TRACEE_EBPF_OBJ_CORE_HEADERS)
95 @@ -421,7 +382,6 @@ $(OUTPUT_DIR)/tracee.bpf.core.o: \
96 -D__BPF_TRACING__ \
97 -DCORE \
98 -I./pkg/ebpf/c/ \
99 - -I$(OUTPUT_DIR)/libbpf/ \
100 -I ./3rdparty/include \
101 -target bpf \
102 -O2 -g \
103 @@ -447,8 +407,8 @@ ifeq ($(STATIC), 1)
104 GO_TAGS_EBPF := $(GO_TAGS_EBPF),netgo
105 endif
107 -CUSTOM_CGO_CFLAGS = "-I$(abspath $(OUTPUT_DIR)/libbpf)"
108 -CUSTOM_CGO_LDFLAGS = "$(shell $(call pkg_config, $(LIB_ELF))) $(shell $(call pkg_config, $(LIB_ZLIB))) $(abspath $(OUTPUT_DIR)/libbpf/libbpf.a)"
109 +CUSTOM_CGO_CFLAGS = ""
110 +CUSTOM_CGO_LDFLAGS = "$(shell $(call pkg_config, $(LIB_BPF))) $(shell $(call pkg_config, $(LIB_ELF))) $(shell $(call pkg_config, $(LIB_ZLIB)))"
112 GO_ENV_EBPF =
113 GO_ENV_EBPF += GOOS=linux
114 @@ -468,6 +428,7 @@ $(OUTPUT_DIR)/tracee-ebpf: \
115 $(TRACEE_EBPF_SRC) \
116 ./embedded-ebpf.go \
117 | .checkver_$(CMD_GO) \
118 + .checklib_$(LIB_BPF) \
119 .checklib_$(LIB_ELF) \
120 .checklib_$(LIB_ZLIB) \
121 btfhub
122 @@ -658,7 +619,6 @@ test-rules: \
123 .PHONY: test-upstream-libbpfgo
124 test-upstream-libbpfgo: \
125 .checkver_$(CMD_GO) \
126 - $(OUTPUT_DIR)/libbpf/libbpf.a
128 ./tests/libbpfgo.sh $(GO_ENV_EBPF)