Re: linux-next: build warning after merge of the bpf-next tree
On Wed, Nov 11, 2020 at 6:03 AM Qian Cai wrote: > > On Wed, 2020-11-11 at 12:01 +1100, Stephen Rothwell wrote: > > Hi all, > > > > After merging the bpf-next tree, today's linux-next build (powerpc > > ppc64_defconfig) produced this warning: > > > > kernel/bpf/btf.c:4481:20: warning: 'btf_parse_module' defined but not used > > [- > > Wunused-function] > > 4481 | static struct btf *btf_parse_module(const char *module_name, const > > void *data, unsigned int data_size) > > |^~~~ > > > > Introduced by commit > > > > 36e68442d1af ("bpf: Load and verify kernel module BTFs") > > > > It loos like btf_parse_module() is only used when > CONFIG_DEBUG_INFO_BTF_MODULES=y, so this should fix it. Fixed already in [0]. [0] https://patchwork.kernel.org/project/netdevbpf/patch/2020040645.903494-1-and...@kernel.org/ > > diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c > index 0f1fd2669d69..e877eeebc616 100644 > --- a/kernel/bpf/btf.c > +++ b/kernel/bpf/btf.c > @@ -4478,6 +4478,7 @@ struct btf *btf_parse_vmlinux(void) > return ERR_PTR(err); > } > > +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES > static struct btf *btf_parse_module(const char *module_name, const void > *data, unsigned int data_size) > { > struct btf_verifier_env *env = NULL; > @@ -4546,6 +4547,7 @@ static struct btf *btf_parse_module(const char > *module_name, const void *data, u > } > return ERR_PTR(err); > } > +#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */ > > struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) > { >
Re: linux-next: build warning after merge of the bpf-next tree
On Wed, 2020-11-11 at 12:01 +1100, Stephen Rothwell wrote: > Hi all, > > After merging the bpf-next tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > kernel/bpf/btf.c:4481:20: warning: 'btf_parse_module' defined but not used [- > Wunused-function] > 4481 | static struct btf *btf_parse_module(const char *module_name, const > void *data, unsigned int data_size) > |^~~~ > > Introduced by commit > > 36e68442d1af ("bpf: Load and verify kernel module BTFs") > It loos like btf_parse_module() is only used when CONFIG_DEBUG_INFO_BTF_MODULES=y, so this should fix it. diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c index 0f1fd2669d69..e877eeebc616 100644 --- a/kernel/bpf/btf.c +++ b/kernel/bpf/btf.c @@ -4478,6 +4478,7 @@ struct btf *btf_parse_vmlinux(void) return ERR_PTR(err); } +#ifdef CONFIG_DEBUG_INFO_BTF_MODULES static struct btf *btf_parse_module(const char *module_name, const void *data, unsigned int data_size) { struct btf_verifier_env *env = NULL; @@ -4546,6 +4547,7 @@ static struct btf *btf_parse_module(const char *module_name, const void *data, u } return ERR_PTR(err); } +#endif /* CONFIG_DEBUG_INFO_BTF_MODULES */ struct btf *bpf_prog_get_target_btf(const struct bpf_prog *prog) {
Re: linux-next: build warning after merge of the bpf-next tree
On Tue, Jul 14, 2020 at 4:15 AM Jiri Olsa wrote: > > On Tue, Jul 14, 2020 at 12:47:02PM +0200, Jiri Olsa wrote: > > On Tue, Jul 14, 2020 at 08:33:41PM +1000, Stephen Rothwell wrote: > > > > SNIP > > > > > > diff --git a/tools/bpf/resolve_btfids/Makefile > > > > b/tools/bpf/resolve_btfids/Makefile > > > > index 948378ca73d4..a88cd4426398 100644 > > > > --- a/tools/bpf/resolve_btfids/Makefile > > > > +++ b/tools/bpf/resolve_btfids/Makefile > > > > @@ -16,6 +16,20 @@ else > > > >MAKEFLAGS=--no-print-directory > > > > endif > > > > > > > > +# always use the host compiler > > > > +ifneq ($(LLVM),) > > > > +HOSTAR ?= llvm-ar > > > > +HOSTCC ?= clang > > > > +HOSTLD ?= ld.lld > > > > +else > > > > +HOSTAR ?= ar > > > > +HOSTCC ?= gcc > > > > +HOSTLD ?= ld > > > > +endif > > > > +AR = $(HOSTAR) > > > > +CC = $(HOSTCC) > > > > +LD = $(HOSTLD) > > > > + > > > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > > > > > > > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > > > > > > > > > > Thanks for the quick response. However, in the mean time the bpf-next > > > tree has been merged into the net-next tree, so these fixes will be > > > needed there ASAP. > > > > I just posted it > > ugh, you said net-next.. > > David, do you need me to repost with net-next tag? > https://lore.kernel.org/bpf/20200714102534.299280-1-jo...@kernel.org/T/ NO. The fixes must go into bpf-next first.
Re: linux-next: build warning after merge of the bpf-next tree
On Tue, Jul 14, 2020 at 12:47:02PM +0200, Jiri Olsa wrote: > On Tue, Jul 14, 2020 at 08:33:41PM +1000, Stephen Rothwell wrote: > > SNIP > > > > diff --git a/tools/bpf/resolve_btfids/Makefile > > > b/tools/bpf/resolve_btfids/Makefile > > > index 948378ca73d4..a88cd4426398 100644 > > > --- a/tools/bpf/resolve_btfids/Makefile > > > +++ b/tools/bpf/resolve_btfids/Makefile > > > @@ -16,6 +16,20 @@ else > > >MAKEFLAGS=--no-print-directory > > > endif > > > > > > +# always use the host compiler > > > +ifneq ($(LLVM),) > > > +HOSTAR ?= llvm-ar > > > +HOSTCC ?= clang > > > +HOSTLD ?= ld.lld > > > +else > > > +HOSTAR ?= ar > > > +HOSTCC ?= gcc > > > +HOSTLD ?= ld > > > +endif > > > +AR = $(HOSTAR) > > > +CC = $(HOSTCC) > > > +LD = $(HOSTLD) > > > + > > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > > > > > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > > > > > > > Thanks for the quick response. However, in the mean time the bpf-next > > tree has been merged into the net-next tree, so these fixes will be > > needed there ASAP. > > I just posted it ugh, you said net-next.. David, do you need me to repost with net-next tag? https://lore.kernel.org/bpf/20200714102534.299280-1-jo...@kernel.org/T/ jirka
Re: linux-next: build warning after merge of the bpf-next tree
On Tue, Jul 14, 2020 at 08:33:41PM +1000, Stephen Rothwell wrote: SNIP > > diff --git a/tools/bpf/resolve_btfids/Makefile > > b/tools/bpf/resolve_btfids/Makefile > > index 948378ca73d4..a88cd4426398 100644 > > --- a/tools/bpf/resolve_btfids/Makefile > > +++ b/tools/bpf/resolve_btfids/Makefile > > @@ -16,6 +16,20 @@ else > >MAKEFLAGS=--no-print-directory > > endif > > > > +# always use the host compiler > > +ifneq ($(LLVM),) > > +HOSTAR ?= llvm-ar > > +HOSTCC ?= clang > > +HOSTLD ?= ld.lld > > +else > > +HOSTAR ?= ar > > +HOSTCC ?= gcc > > +HOSTLD ?= ld > > +endif > > +AR = $(HOSTAR) > > +CC = $(HOSTCC) > > +LD = $(HOSTLD) > > + > > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > > > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > > > > Thanks for the quick response. However, in the mean time the bpf-next > tree has been merged into the net-next tree, so these fixes will be > needed there ASAP. I just posted it jirka
Re: linux-next: build warning after merge of the bpf-next tree
Hi Jiri, On Tue, 14 Jul 2020 11:00:48 +0200 Jiri Olsa wrote: > > On Tue, Jul 14, 2020 at 12:16:08PM +1000, Stephen Rothwell wrote: > > > > After merging the bpf-next tree, today's linux-next build (powerpc > > ppc64_defconfig) produced this warning: > > > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > > > Presumably ntroduced by the merge of the resolve_btfids branch. > > missing one more #ifdef.. chage below fixes it for me, > it's squashed with the fix for the arm build, I'll post > both fixes today > > thanks, > jirka > > > --- > diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h > index fe019774f8a7..2f9754a4ab2b 100644 > --- a/include/linux/btf_ids.h > +++ b/include/linux/btf_ids.h > @@ -3,6 +3,8 @@ > #ifndef _LINUX_BTF_IDS_H > #define _LINUX_BTF_IDS_H > > +#ifdef CONFIG_DEBUG_INFO_BTF > + > #include /* for __PASTE */ > > /* > @@ -21,7 +23,7 @@ > asm( \ > ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ > ".local " #symbol " ; \n" \ > -".type " #symbol ", @object; \n" \ > +".type " #symbol ", STT_OBJECT; \n" \ > ".size " #symbol ", 4;\n" \ > #symbol ": \n" \ > ".zero 4 \n" \ > @@ -83,5 +85,12 @@ asm( > \ > ".zero 4 \n" \ > ".popsection; \n"); > > +#else > + > +#define BTF_ID_LIST(name) u32 name[5]; > +#define BTF_ID(prefix, name) > +#define BTF_ID_UNUSED > + > +#endif /* CONFIG_DEBUG_INFO_BTF */ > > #endif > diff --git a/tools/bpf/resolve_btfids/Makefile > b/tools/bpf/resolve_btfids/Makefile > index 948378ca73d4..a88cd4426398 100644 > --- a/tools/bpf/resolve_btfids/Makefile > +++ b/tools/bpf/resolve_btfids/Makefile > @@ -16,6 +16,20 @@ else >MAKEFLAGS=--no-print-directory > endif > > +# always use the host compiler > +ifneq ($(LLVM),) > +HOSTAR ?= llvm-ar > +HOSTCC ?= clang > +HOSTLD ?= ld.lld > +else > +HOSTAR ?= ar > +HOSTCC ?= gcc > +HOSTLD ?= ld > +endif > +AR = $(HOSTAR) > +CC = $(HOSTCC) > +LD = $(HOSTLD) > + > OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ > > LIBBPF_SRC := $(srctree)/tools/lib/bpf/ > Thanks for the quick response. However, in the mean time the bpf-next tree has been merged into the net-next tree, so these fixes will be needed there ASAP. -- Cheers, Stephen Rothwell pgpEDacWmclOG.pgp Description: OpenPGP digital signature
Re: linux-next: build warning after merge of the bpf-next tree
On Tue, Jul 14, 2020 at 11:02 AM Jiri Olsa wrote: > On Tue, Jul 14, 2020 at 12:16:08PM +1000, Stephen Rothwell wrote: > > After merging the bpf-next tree, today's linux-next build (powerpc > > ppc64_defconfig) produced this warning: > > > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' > > being placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > > in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > > placed in section `.BTF_ids' > > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being > > placed in section `.BTF_ids' > > > > Presumably ntroduced by the merge of the resolve_btfids branch. > > missing one more #ifdef.. chage below fixes it for me, > it's squashed with the fix for the arm build, I'll post > both fixes today This one works for me, too: Tested-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds
Re: linux-next: build warning after merge of the bpf-next tree
On Tue, Jul 14, 2020 at 12:16:08PM +1000, Stephen Rothwell wrote: > Hi all, > > After merging the bpf-next tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being placed > in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being placed > in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/trace/bpf_trace.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/btf.o' being placed > in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `kernel/bpf/stackmap.o' being > placed in section `.BTF_ids' > ld: warning: orphan section `.BTF_ids' from `net/core/filter.o' being placed > in section `.BTF_ids' > > Presumably ntroduced by the merge of the resolve_btfids branch. missing one more #ifdef.. chage below fixes it for me, it's squashed with the fix for the arm build, I'll post both fixes today thanks, jirka --- diff --git a/include/linux/btf_ids.h b/include/linux/btf_ids.h index fe019774f8a7..2f9754a4ab2b 100644 --- a/include/linux/btf_ids.h +++ b/include/linux/btf_ids.h @@ -3,6 +3,8 @@ #ifndef _LINUX_BTF_IDS_H #define _LINUX_BTF_IDS_H +#ifdef CONFIG_DEBUG_INFO_BTF + #include /* for __PASTE */ /* @@ -21,7 +23,7 @@ asm( \ ".pushsection " BTF_IDS_SECTION ",\"a\"; \n" \ ".local " #symbol " ; \n" \ -".type " #symbol ", @object; \n" \ +".type " #symbol ", STT_OBJECT; \n" \ ".size " #symbol ", 4;\n" \ #symbol ": \n" \ ".zero 4 \n" \ @@ -83,5 +85,12 @@ asm( \ ".zero 4 \n" \ ".popsection; \n"); +#else + +#define BTF_ID_LIST(name) u32 name[5]; +#define BTF_ID(prefix, name) +#define BTF_ID_UNUSED + +#endif /* CONFIG_DEBUG_INFO_BTF */ #endif diff --git a/tools/bpf/resolve_btfids/Makefile b/tools/bpf/resolve_btfids/Makefile index 948378ca73d4..a88cd4426398 100644 --- a/tools/bpf/resolve_btfids/Makefile +++ b/tools/bpf/resolve_btfids/Makefile @@ -16,6 +16,20 @@ else MAKEFLAGS=--no-print-directory endif +# always use the host compiler +ifneq ($(LLVM),) +HOSTAR ?= llvm-ar +HOSTCC ?= clang +HOSTLD ?= ld.lld +else +HOSTAR ?= ar +HOSTCC ?= gcc +HOSTLD ?= ld +endif +AR = $(HOSTAR) +CC = $(HOSTCC) +LD = $(HOSTLD) + OUTPUT ?= $(srctree)/tools/bpf/resolve_btfids/ LIBBPF_SRC := $(srctree)/tools/lib/bpf/
Re: linux-next: build warning after merge of the bpf-next tree
On Fri, Oct 18, 2019 at 10:56:57AM +1100, Stephen Rothwell wrote: > Hi all, > > After merging the bpf-next tree, today's linux-next build (powerpc > ppc64_defconfig) produced this warning: > > WARNING: 2 bad relocations > c1998a48 R_PPC64_ADDR64_binary__btf_vmlinux_bin_start > c1998a50 R_PPC64_ADDR64_binary__btf_vmlinux_bin_end Can ppc folks help me figure out what this warning means?