tools/resolve_btfids: build with host flags
Subsystems (3)
PATCH 1/1 tools/resolve_btfids: build with host flags
resolve_btfids is built using $(HOSTCC) and $(HOSTLD) but does not pick up the corresponding flags. As a result, host-specific settings (such as a sysroot specified via HOSTCFLAGS=--sysroot=..., or a linker specified via HOSTLDFLAGS=-fuse-ld=...) will not be respected.
Fix this by setting CFLAGS to KBUILD_HOSTCFLAGS and LDFLAGS to KBUILD_HOSTLDFLAGS.
Also pass the cflags through to libbpf via EXTRA_CFLAGS to ensure that the host libbpf is built with flags consistent with resolve_btfids.
--- tools/bpf/resolve_btfids/Makefile | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-)
tools/bpf/resolve_btfids/Makefile +4 -2
@@ -20,6 +20,8 @@ LD = $(HOSTLD) ARCH = $(HOSTARCH) RM ?= rm CROSS_COMPILE = +CFLAGS := $(KBUILD_HOSTCFLAGS) +LDFLAGS := $(KBUILD_HOSTLDFLAGS) OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/
@@ -47,10 +49,10 @@ $(SUBCMDOBJ): fixdep FORCE | $(OUTPUT)/libsubcmd $(BPFOBJ): $(wildcard $(LIBBPF_SRC)/*.[ch] $(LIBBPF_SRC)/Makefile) | $(LIBBPF_OUT) $(Q)$(MAKE) $(submake_extras) -C $(LIBBPF_SRC) OUTPUT=$(LIBBPF_OUT) \ - DESTDIR=$(LIBBPF_DESTDIR) prefix= \ + DESTDIR=$(LIBBPF_DESTDIR) prefix= EXTRA_CFLAGS="$(CFLAGS)" \ $(abspath $@) install_headers -CFLAGS := -g \ +CFLAGS += -g \ -I$(srctree)/tools/include \ -I$(srctree)/tools/include/uapi \ -I$(LIBBPF_INCLUDE) \
Signature · 1 line
2.34.1.575.g55b058a8bb-goog
Quoted 6 lines · Connor O'Brien
resolve_btfidsis built using $(HOSTCC) and $(HOSTLD) but does not pick up the corresponding flags. As a result, host-specific settings (such as a sysroot specified via HOSTCFLAGS=--sysroot=..., or a linker specified via HOSTLDFLAGS=-fuse-ld=...) will not be respected.
Quoted 7 lines
Fix this by setting CFLAGS to
KBUILD_HOSTCFLAGSand LDFLAGS toKBUILD_HOSTLDFLAGS.Also pass the cflags through to libbpf via
EXTRA_CFLAGSto ensure that the host libbpf is built with flags consistent withresolve_btfids.Signed-off-by Connor O'Brien <[email protected]>
I guess this should go to bpf-next tree?
Other than that,
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Hello:
This patch was applied to bpf/bpf-next.git (master) by Andrii Nakryiko <[email protected]>:
Quoted 9 lines · On Wed, 12 Jan 2022 00:25:03 +0000 you wrote:
resolve_btfidsis built using $(HOSTCC) and $(HOSTLD) but does not pick up the corresponding flags. As a result, host-specific settings (such as a sysroot specified via HOSTCFLAGS=--sysroot=..., or a linker specified via HOSTLDFLAGS=-fuse-ld=...) will not be respected.Fix this by setting CFLAGS to
KBUILD_HOSTCFLAGSand LDFLAGS toKBUILD_HOSTLDFLAGS.[...]
Here is the summary with links:
- [bpf] tools/resolve_btfids: build with host flags
https://git.kernel.org/bpf/bpf-next/c/0e3a1c902ffb
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html