Commit 56a2df76 authored by Jiri Olsa's avatar Jiri Olsa Committed by Daniel Borkmann

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: 13e07691 ("tools/resolve_btfids: Alter how HOSTCC is forced")
Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
Tested-by: default avatarNathan Chancellor <nathan@kernel.org>
Acked-by: default avatarIan Rogers <irogers@google.com>
Link: https://lore.kernel.org/bpf/20230202112839.1131892-1-jolsa@kernel.org
parent 8306829b
hostprogs := resolve_btfids
resolve_btfids-y += main.o resolve_btfids-y += main.o
resolve_btfids-y += rbtree.o resolve_btfids-y += rbtree.o
resolve_btfids-y += zalloc.o resolve_btfids-y += zalloc.o
...@@ -7,4 +9,4 @@ resolve_btfids-y += str_error_r.o ...@@ -7,4 +9,4 @@ resolve_btfids-y += str_error_r.o
$(OUTPUT)%.o: ../../lib/%.c FORCE $(OUTPUT)%.o: ../../lib/%.c FORCE
$(call rule_mkdir) $(call rule_mkdir)
$(call if_changed_dep,cc_o_c) $(call if_changed_dep,host_cc_o_c)
...@@ -22,6 +22,9 @@ HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH) ...@@ -22,6 +22,9 @@ HOST_OVERRIDES := AR="$(HOSTAR)" CC="$(HOSTCC)" LD="$(HOSTLD)" ARCH="$(HOSTARCH)
EXTRA_CFLAGS="$(HOSTCFLAGS) $(KBUILD_HOSTCFLAGS)" EXTRA_CFLAGS="$(HOSTCFLAGS) $(KBUILD_HOSTCFLAGS)"
RM ?= rm RM ?= rm
HOSTCC ?= gcc
HOSTLD ?= ld
HOSTAR ?= ar
CROSS_COMPILE = CROSS_COMPILE =
OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
...@@ -64,7 +67,7 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU ...@@ -64,7 +67,7 @@ $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OU
LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null) LIBELF_FLAGS := $(shell $(HOSTPKG_CONFIG) libelf --cflags 2>/dev/null)
LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf) LIBELF_LIBS := $(shell $(HOSTPKG_CONFIG) libelf --libs 2>/dev/null || echo -lelf)
CFLAGS += -g \ HOSTCFLAGS += -g \
-I$(srctree)/tools/include \ -I$(srctree)/tools/include \
-I$(srctree)/tools/include/uapi \ -I$(srctree)/tools/include/uapi \
-I$(LIBBPF_INCLUDE) \ -I$(LIBBPF_INCLUDE) \
...@@ -73,11 +76,11 @@ CFLAGS += -g \ ...@@ -73,11 +76,11 @@ CFLAGS += -g \
LIBS = $(LIBELF_LIBS) -lz LIBS = $(LIBELF_LIBS) -lz
export srctree OUTPUT CFLAGS Q export srctree OUTPUT HOSTCFLAGS Q HOSTCC HOSTLD HOSTAR
include $(srctree)/tools/build/Makefile.include include $(srctree)/tools/build/Makefile.include
$(BINARY_IN): fixdep FORCE prepare | $(OUTPUT) $(BINARY_IN): fixdep FORCE prepare | $(OUTPUT)
$(Q)$(MAKE) $(build)=resolve_btfids $(HOST_OVERRIDES) $(Q)$(MAKE) $(build)=resolve_btfids
$(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN) $(BINARY): $(BPFOBJ) $(SUBCMDOBJ) $(BINARY_IN)
$(call msg,LINK,$@) $(call msg,LINK,$@)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment