Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932389AbbGGPKg (ORCPT ); Tue, 7 Jul 2015 11:10:36 -0400 Received: from mail.kernel.org ([198.145.29.136]:52352 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757561AbbGGPKW (ORCPT ); Tue, 7 Jul 2015 11:10:22 -0400 Date: Tue, 7 Jul 2015 12:10:17 -0300 From: Arnaldo Carvalho de Melo To: Wang Nan Cc: ast@plumgrid.com, brendan.d.gregg@gmail.com, daniel@iogearbox.net, namhyung@kernel.org, masami.hiramatsu.pt@hitachi.com, paulus@samba.org, a.p.zijlstra@chello.nl, mingo@redhat.com, jolsa@kernel.org, dsahern@gmail.com, linux-kernel@vger.kernel.org, lizefan@huawei.com, hekuang@huawei.com, xiakaixu@huawei.com, pi3orama@163.com Subject: Re: [RFC PATCH v10 11/50] bpf tools: Collect symbol table from SHT_SYMTAB section Message-ID: <20150707151017.GJ3326@kernel.org> References: <1435716878-189507-1-git-send-email-wangnan0@huawei.com> <1435716878-189507-12-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1435716878-189507-12-git-send-email-wangnan0@huawei.com> X-Url: http://acmel.wordpress.com User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2281 Lines: 70 Em Wed, Jul 01, 2015 at 02:13:59AM +0000, Wang Nan escreveu: > This patch collects symbols section. This section is useful when > linking ELF maps. I guess it is, but could you ellaborate on this? I.e. _how_ is this useful? I can imagine some ways, but would be nice if you outlined what is the first thing you will do with this, as a justification for this patch. I am applying the patches, compile testing them and will try the end result, but please consider being more verbose in the justification for each patch, not requiring the reviewer to go on looking at other patches to figure out what a patch is good for. I will happily 'git commit -i' the patches to amend the patch descriptions. This is valid for me of for anybody else trying to make sense of your patches. - Arnaldo > Signed-off-by: Wang Nan > Acked-by: Alexei Starovoitov > --- > tools/lib/bpf/libbpf.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c > index 87f5054..9b016c0 100644 > --- a/tools/lib/bpf/libbpf.c > +++ b/tools/lib/bpf/libbpf.c > @@ -94,6 +94,7 @@ struct bpf_object { > size_t obj_buf_sz; > Elf *elf; > GElf_Ehdr ehdr; > + Elf_Data *symbols; > } efile; > char path[]; > }; > @@ -135,6 +136,7 @@ static void bpf_object__elf_finish(struct bpf_object *obj) > elf_end(obj->efile.elf); > obj->efile.elf = NULL; > } > + obj->efile.symbols = NULL; > zclose(obj->efile.fd); > obj->efile.obj_buf = NULL; > obj->efile.obj_buf_sz = 0; > @@ -333,6 +335,14 @@ static int bpf_object__elf_collect(struct bpf_object *obj) > else if (strcmp(name, "maps") == 0) > err = bpf_object__init_maps(obj, data->d_buf, > data->d_size); > + else if (sh.sh_type == SHT_SYMTAB) { > + if (obj->efile.symbols) { > + pr_warning("bpf: multiple SYMTAB in %s\n", > + obj->path); > + err = -EEXIST; > + } else > + obj->efile.symbols = data; > + } > if (err) > goto out; > } > -- > 1.8.3.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/