From mboxrd@z Thu Jan 1 00:00:00 1970 From: Arnaldo Carvalho de Melo Subject: Re: [PATCH bpf-next v5 00/10] BTF: BPF Type Format Date: Fri, 15 Jun 2018 11:24:57 -0300 Message-ID: <20180615142457.GL30043@kernel.org> References: <20180612203124.GB22039@kernel.org> <20180612204126.GC22039@kernel.org> <20180613232638.yyhktiovl6oeawgt@kafai-mbp> <20180614150334.GF30043@kernel.org> <20180614162227.r72d7wk57unfhqvo@kafai-mbp.dhcp.thefacebook.com> <20180614171806.GG30043@kernel.org> <1e7a418d-53e8-ee72-5a13-7e2df5a48000@fb.com> <20180614174759.GI30043@kernel.org> <20180614180017.GJ30043@kernel.org> <10dfa74e-65e7-1787-c646-9077e1acdf9e@fb.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: Alexei Starovoitov , Martin KaFai Lau , netdev@vger.kernel.org, Daniel Borkmann , kernel-team@fb.com, Wang Nan , Jiri Olsa , Namhyung Kim , Ingo Molnar To: Yonghong Song Return-path: Received: from mail.kernel.org ([198.145.29.99]:57586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755816AbeFOOZH (ORCPT ); Fri, 15 Jun 2018 10:25:07 -0400 Content-Disposition: inline In-Reply-To: <10dfa74e-65e7-1787-c646-9077e1acdf9e@fb.com> Sender: netdev-owner@vger.kernel.org List-ID: Em Thu, Jun 14, 2018 at 09:56:43PM -0700, Yonghong Song escreveu: > I really want to get rid of this option as well. To make pahole work > with the default default format, I need to add bpf support to > libdwfl in elfutils repo. I will work on that. Right, I haven't looked into detail, but perhaps we can do like we do in tools/perf/ where we add a feature test to check if some function is present in a library (elfutils even) and if so, use it, otherwise, use a copy that we carry in pahole.git. For instance: tools/perf/util/symbol-elf.c #ifndef HAVE_ELF_GETPHDRNUM_SUPPORT static int elf_getphdrnum(Elf *elf, size_t *dst) { GElf_Ehdr gehdr; GElf_Ehdr *ehdr; ehdr = gelf_getehdr(elf, &gehdr); if (!ehdr) return -1; *dst = ehdr->e_phnum; return 0; } #endif And we have a feature test to check if that is present, simple one, if that builds and links, we have it, then the tools build Makefile magic will end up defining HAVE_ELF_GETPHDRNUM_SUPPORT and our copy doesn't get included, using what is in elfutils: [acme@jouet perf]$ cat tools/build/feature/test-libelf-getphdrnum.c // SPDX-License-Identifier: GPL-2.0 #include int main(void) { size_t dst; return elf_getphdrnum(0, &dst); } [acme@jouet perf]$ [acme@jouet perf]$ grep elf /tmp/build/perf/FEATURE-DUMP feature-libelf=1 feature-libelf-getphdrnum=1 feature-libelf-gelf_getnote=1 feature-libelf-getshdrstrndx=1 feature-libelf-mmap=1 [acme@jouet perf]$ This way a new pahole version won't get to wait till places where it gets built have these new functions and we stop using it as soon as the library get it. - Arnaldo