Skip to content

Commit 02bf597

Browse files
viktormalikfmaurer-rh
authored andcommitted
tools/resolve_btfids: Fix setting HOSTCFLAGS
Bugzilla: https://bugzilla.redhat.com/2178930 Upstream status: https://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next.git commit edd75c8 Author: Viktor Malik <vmalik@redhat.com> Date: Tue May 30 14:33:52 2023 +0200 tools/resolve_btfids: Fix setting HOSTCFLAGS Building BPF selftests with custom HOSTCFLAGS yields an error: # make HOSTCFLAGS="-O2" [...] HOSTCC ./tools/testing/selftests/bpf/tools/build/resolve_btfids/main.o main.c:73:10: fatal error: linux/rbtree.h: No such file or directory 73 | #include <linux/rbtree.h> | ^~~~~~~~~~~~~~~~ The reason is that tools/bpf/resolve_btfids/Makefile passes header include paths by extending HOSTCFLAGS which is overridden by setting HOSTCFLAGS in the make command (because of Makefile rules [1]). This patch fixes the above problem by passing the include paths via `HOSTCFLAGS_resolve_btfids` which is used by tools/build/Build.include and can be combined with overridding HOSTCFLAGS. [1] https://www.gnu.org/software/make/manual/html_node/Overriding.html Fixes: 56a2df7 ("tools/resolve_btfids: Compile resolve_btfids as host program") Signed-off-by: Viktor Malik <vmalik@redhat.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Acked-by: Jiri Olsa <jolsa@kernel.org> Link: https://lore.kernel.org/bpf/20230530123352.1308488-1-vmalik@redhat.com Signed-off-by: Viktor Malik <vmalik@redhat.com>
1 parent d7c5b9e commit 02bf597

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tools/bpf/resolve_btfids/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
6767
LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
6868
LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
6969

70-
HOSTCFLAGS += -g \
70+
HOSTCFLAGS_resolve_btfids += -g \
7171
-I$(srctree)/tools/include \
7272
-I$(srctree)/tools/include/uapi \
7373
-I$(LIBBPF_INCLUDE) \
@@ -76,7 +76,7 @@ HOSTCFLAGS += -g \
7676

7777
LIBS = $(LIBELF_LIBS) -lz
7878

79-
export srctree OUTPUT HOSTCFLAGS Q HOSTCC HOSTLD HOSTAR
79+
export srctree OUTPUT HOSTCFLAGS_resolve_btfids Q HOSTCC HOSTLD HOSTAR
8080
include $(srctree)/tools/build/Makefile.include
8181

8282
$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)

0 commit comments

Comments
 (0)