Re: [PATCH v2 bpf-next 13/18] kbuild: Add support for BTF inline information
From: Alan Maguire <hidden>
Date: 2026-09-16 07:43:31
Also in:
bpf
On 14/09/2026 08:50, Nicolas Schier wrote:
On Tue, Sep 01, 2026 at 05:57:52PM +0100, Alan Maguire wrote:quoted
Add CONFIG_DEBUG_INFO_BTF_INLINE to generate BTF inline-location information with pahole v1.31 and later. Enable pahole's inline feature and pass --inline to resolve_btfids. This extracts LOC_PARAM, LOC_PROTO, and LOCSEC types into a split BTF blob named <output>.BTF.inline while the ordinary BTF remains in .BTF. Embed the resulting blob in a .BTF.inline ELF section for vmlinux and modules. Add the vmlinux linker-script output section to avoid it being treated as an orphan. Use the inline pahole feature unconditionally for both in-tree and external modules; the generated split BTF has the same format in both cases. Signed-off-by: Alan Maguire <redacted> --- include/asm-generic/vmlinux.lds.h | 11 +++++++++++ lib/Kconfig.debug | 17 +++++++++++++++++ scripts/Makefile.btf | 7 +++++++ scripts/gen-btf.sh | 17 +++++++++++++++-- 4 files changed, 50 insertions(+), 2 deletions(-)[...]quoted
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index 1244dcac2294..dd1b2d9ebe99 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug@@ -425,6 +425,12 @@ config PAHOLE_HAS_LANG_EXCLUDE otherwise it would emit malformed kernel and module binaries when using DEBUG_INFO_BTF_MODULES. +config PAHOLE_HAS_INLINE + def_bool PAHOLE_VERSION >= 131[...]quoted
+config DEBUG_INFO_BTF_INLINE + bool "Provide information about inline sites in BTF" + default n + depends on DEBUG_INFO_BTF && PAHOLE_HAS_INLINE && SYSFS[...]quoted
diff --git a/scripts/Makefile.btf b/scripts/Makefile.btf index a1812985a61a..d42dbc8d7199 100644 --- a/scripts/Makefile.btf +++ b/scripts/Makefile.btf@@ -22,7 +22,14 @@ endif pahole-flags-$(CONFIG_PAHOLE_HAS_LANG_EXCLUDE) += --lang_exclude=rust +btf-inline := $(CONFIG_DEBUG_INFO_BTF_INLINE) +ifneq ($(btf-inline),) +btf-inline-feat := inline +pahole-flags-$(call test-ge, $(pahole-ver), 131) += --btf_features=$(btf-inline-feat) +endif + export PAHOLE_FLAGS := $(pahole-flags-y) +export BTF_INLINE := $(btf-inline)As btf-inline and btf-inline-feat are not used anywhere else, and CONFIG_DEBUG_INFO_BTF_INLINE can only be set for PAHOLE_VERSION >= 131, this looks a bit noisy to me. I think it would be good to keep that change in scripts/Makefile.btf as short as possible, e.g.: pahole-flags-$(CONFIG_DEBUG_INFO_BTF_INLINE) += --btf_features=inline and for scripts/gen-btf.sh something like: if is_enabled CONFIG_DEBUG_INFO_BTF_INLINE; then BTF_INLINE=inline fi
looks good, I'll make that change for the next revision (splitting this into multiple series so the kbuild aspects will follow a bit later). Thanks again for taking a look! Alan