Skip to content

Commit 56a2df7

Browse files
olsajiriborkmann
authored andcommitted
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: 13e0769 ("tools/resolve_btfids: Alter how HOSTCC is forced") Reported-by: Nathan Chancellor <[email protected]> Signed-off-by: Jiri Olsa <[email protected]> Signed-off-by: Daniel Borkmann <[email protected]> Tested-by: Nathan Chancellor <[email protected]> Acked-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/bpf/[email protected]
1 parent 8306829 commit 56a2df7

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

tools/bpf/resolve_btfids/Build

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
hostprogs := resolve_btfids
2+
13
resolve_btfids-y += main.o
24
resolve_btfids-y += rbtree.o
35
resolve_btfids-y += zalloc.o
@@ -7,4 +9,4 @@ resolve_btfids-y += str_error_r.o
79

810
$(OUTPUT)%.o: ../../lib/%.c FORCE
911
$(call rule_mkdir)
10-
$(call if_changed_dep,cc_o_c)
12+
$(call if_changed_dep,host_cc_o_c)

tools/bpf/resolve_btfids/Makefile

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)
2222
EXTRA_CFLAGS="$(HOSTCFLAGS) $(KBUILD_HOSTCFLAGS)"
2323

2424
RM ?= rm
25+
HOSTCC ?= gcc
26+
HOSTLD ?= ld
27+
HOSTAR ?= ar
2528
CROSS_COMPILE =
2629

2730
OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
@@ -64,7 +67,7 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
6467
LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
6568
LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
6669

67-
CFLAGS += -g \
70+
HOSTCFLAGS += -g \
6871
-I$(srctree)/tools/include \
6972
-I$(srctree)/tools/include/uapi \
7073
-I$(LIBBPF_INCLUDE) \
@@ -73,11 +76,11 @@ CFLAGS += -g \
7376

7477
LIBS = $(LIBELF_LIBS) -lz
7578

76-
export srctree OUTPUT CFLAGS Q
79+
export srctree OUTPUT HOSTCFLAGS Q HOSTCC HOSTLD HOSTAR
7780
include $(srctree)/tools/build/Makefile.include
7881

7982
$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)
80-
$(Q)$(MAKE) $(build)=resolve_btfids $(HOST_OVERRIDES)
83+
$(Q)$(MAKE) $(build)=resolve_btfids
8184

8285
$(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
8386
$(call msg,LINK,$@)

0 commit comments

Comments
 (0)