netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH bpf-next] tools/bpftool: strip BPF .o files before skeleton generation
@ 2020-07-22  4:38 Andrii Nakryiko
  2020-07-22  8:20 ` Quentin Monnet
  0 siblings, 1 reply; 3+ messages in thread
From: Andrii Nakryiko @ 2020-07-22  4:38 UTC (permalink / raw)
  To: bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team, Andrii Nakryiko

Strip away DWARF info from .bpf.o files, before generating BPF skeletons.
This reduces bpftool binary size from 3.43MB to 2.58MB.

Signed-off-by: Andrii Nakryiko <andriin@fb.com>
---
 tools/bpf/bpftool/Makefile | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/Makefile b/tools/bpf/bpftool/Makefile
index 51bd520ed437..8462690a039b 100644
--- a/tools/bpf/bpftool/Makefile
+++ b/tools/bpf/bpftool/Makefile
@@ -59,6 +59,7 @@ endif
 INSTALL ?= install
 RM ?= rm -f
 CLANG ?= clang
+LLVM_STRIP ?= llvm-strip
 
 FEATURE_USER = .bpftool
 FEATURE_TESTS = libbfd disassembler-four-args reallocarray zlib libcap \
@@ -147,7 +148,7 @@ $(OUTPUT)%.bpf.o: skeleton/%.bpf.c $(OUTPUT)vmlinux.h $(LIBBPF)
 		-I$(srctree)/tools/include/uapi/ \
 		-I$(LIBBPF_PATH) \
 		-I$(srctree)/tools/lib \
-		-g -O2 -target bpf -c $< -o $@
+		-g -O2 -target bpf -c $< -o $@ && $(LLVM_STRIP) -g $@
 
 $(OUTPUT)%.skel.h: $(OUTPUT)%.bpf.o $(BPFTOOL_BOOTSTRAP)
 	$(QUIET_GEN)$(BPFTOOL_BOOTSTRAP) gen skeleton $< > $@
-- 
2.24.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] tools/bpftool: strip BPF .o files before skeleton generation
  2020-07-22  4:38 [PATCH bpf-next] tools/bpftool: strip BPF .o files before skeleton generation Andrii Nakryiko
@ 2020-07-22  8:20 ` Quentin Monnet
  2020-07-23  5:10   ` Alexei Starovoitov
  0 siblings, 1 reply; 3+ messages in thread
From: Quentin Monnet @ 2020-07-22  8:20 UTC (permalink / raw)
  To: Andrii Nakryiko, bpf, netdev, ast, daniel; +Cc: andrii.nakryiko, kernel-team

On 22/07/2020 05:38, Andrii Nakryiko wrote:
> Strip away DWARF info from .bpf.o files, before generating BPF skeletons.
> This reduces bpftool binary size from 3.43MB to 2.58MB.
> 
> Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Acked-by: Quentin Monnet <quentin@isovalent.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH bpf-next] tools/bpftool: strip BPF .o files before skeleton generation
  2020-07-22  8:20 ` Quentin Monnet
@ 2020-07-23  5:10   ` Alexei Starovoitov
  0 siblings, 0 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2020-07-23  5:10 UTC (permalink / raw)
  To: Quentin Monnet
  Cc: Andrii Nakryiko, bpf, Network Development, Alexei Starovoitov,
	Daniel Borkmann, Andrii Nakryiko, Kernel Team

On Wed, Jul 22, 2020 at 1:21 AM Quentin Monnet <quentin@isovalent.com> wrote:
>
> On 22/07/2020 05:38, Andrii Nakryiko wrote:
> > Strip away DWARF info from .bpf.o files, before generating BPF skeletons.
> > This reduces bpftool binary size from 3.43MB to 2.58MB.
> >
> > Signed-off-by: Andrii Nakryiko <andriin@fb.com>
> Acked-by: Quentin Monnet <quentin@isovalent.com>

Applied. Thanks

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-07-23  5:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-22  4:38 [PATCH bpf-next] tools/bpftool: strip BPF .o files before skeleton generation Andrii Nakryiko
2020-07-22  8:20 ` Quentin Monnet
2020-07-23  5:10   ` Alexei Starovoitov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).