Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

tools/resolve_btfids: Compile resolve_btfids as host program

Making resolve_btfids to be compiled as host program so
we can avoid cross compile issues as reported by Nathan.

Also we no longer need HOST_OVERRIDES for BINARY target,
just for 'prepare' targets.

Fixes: 13e07691a16f ("tools/resolve_btfids: Alter how HOSTCC is forced")
Reported-by: Nathan Chancellor <nathan@kernel.org>
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Ian Rogers <irogers@google.com>
Link: https://lore.kernel.org/bpf/20230202112839.1131892-1-jolsa@kernel.org

authored by

Jiri Olsa and committed by
Daniel Borkmann
56a2df76 8306829b

+9 -4
+3 -1
tools/bpf/resolve_btfids/Build
··· 1 + hostprogs := resolve_btfids 2 + 1 3 resolve_btfids-y += main.o 2 4 resolve_btfids-y += rbtree.o 3 5 resolve_btfids-y += zalloc.o ··· 9 7 10 8 $(OUTPUT)%.o: ../../lib/%.c FORCE 11 9 $(call rule_mkdir) 12 - $(call if_changed_dep,cc_o_c) 10 + $(call if_changed_dep,host_cc_o_c)
+6 -3
tools/bpf/resolve_btfids/Makefile
··· 22 22 EXTRA_CFLAGS="$(HOSTCFLAGS) $(KBUILD_HOSTCFLAGS)" 23 23 24 24 RM ?= rm 25 + HOSTCC ?= gcc 26 + HOSTLD ?= ld 27 + HOSTAR ?= ar 25 28 CROSS_COMPILE = 26 29 27 30 OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ ··· 67 64 LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null) 68 65 LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf) 69 66 70 - CFLAGS += -g \ 67 + HOSTCFLAGS += -g \ 71 68 -I$(srctree)/tools/include \ 72 69 -I$(srctree)/tools/include/uapi \ 73 70 -I$(LIBBPF_INCLUDE) \ ··· 76 73 77 74 LIBS = $(LIBELF_LIBS) -lz 78 75 79 - export srctree OUTPUT CFLAGS Q 76 + export srctree OUTPUT HOSTCFLAGS Q HOSTCC HOSTLD HOSTAR 80 77 include $(srctree)/tools/build/Makefile.include 81 78 82 79 $(BINARY_IN): fixdep FORCE prepare | $(OUTPUT) 83 - $(Q)$(MAKE) $(build)=resolve_btfids $(HOST_OVERRIDES) 80 + $(Q)$(MAKE) $(build)=resolve_btfids 84 81 85 82 $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) 86 83 $(call msg,LINK,$@)