From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yonghong Song Subject: Re: [PATCH bpf-next v5 00/10] BTF: BPF Type Format Date: Thu, 14 Jun 2018 21:56:43 -0700 Message-ID: <10dfa74e-65e7-1787-c646-9077e1acdf9e@fb.com> References: <20180607193029.GG17292@kernel.org> <20180607200701.bvsjzoq56rnggwfd@kafai-mbp> <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> Mime-Version: 1.0 Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 7bit Cc: Martin KaFai Lau , , Daniel Borkmann , , Wang Nan , Jiri Olsa , Namhyung Kim , Ingo Molnar To: Arnaldo Carvalho de Melo , Alexei Starovoitov Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:43994 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755631AbeFOE5Y (ORCPT ); Fri, 15 Jun 2018 00:57:24 -0400 In-Reply-To: <20180614180017.GJ30043@kernel.org> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 6/14/18 11:00 AM, Arnaldo Carvalho de Melo wrote: > Em Thu, Jun 14, 2018 at 02:47:59PM -0300, Arnaldo Carvalho de Melo escreveu: >> Em Thu, Jun 14, 2018 at 10:21:30AM -0700, Alexei Starovoitov escreveu: >>> On 6/14/18 10:18 AM, Arnaldo Carvalho de Melo wrote: >>>> Just out of curiosity, is there any plan to have this as a clang option? > >>> I think >>> clang ... -mllvm -mattr=dwarfris >>> should work. > >> The message "(LLVM option parsing)" implies what you suggest, but didn't >> worked :-\ > >> -mllvm Additional arguments to forward to LLVM's option processing > >> Almost there tho :-\ > > So I thought that this -mattr=dwarfris would be available only after I > set the target, because I tried 'llc -mattr=help' and dwarfris wasn't > there: > > [acme@jouet perf]$ llc -mattr=help |& grep dwarf > [acme@jouet perf]$ > > Only after I set the arch it appears: > > [acme@jouet perf]$ llc -march=bpf -mattr=help |& grep dwarf > dwarfris - Disable MCAsmInfo DwarfUsesRelocationsAcrossSections. > dwarfris - Disable MCAsmInfo DwarfUsesRelocationsAcrossSections. > dwarfris - Disable MCAsmInfo DwarfUsesRelocationsAcrossSections. > [acme@jouet perf]$ > > But even after moving the '-mllvm -mattr=dwarfris' to after '-target > bpf' it still can't grok it :-\ > > /usr/local/bin/clang -D__KERNEL__ -D__NR_CPUS__=4 -DLINUX_VERSION_CODE=0x41100 -g -nostdinc -isystem /usr/lib/gcc/x86_64-redhat-linux/7/include -I/home/acme/git/linux/arch/x86/include -I./arch/x86/include/generated -I/home/acme/git/linux/include -I./include -I/home/acme/git/linux/arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I/home/acme/git/linux/include/uapi -I./include/generated/uapi -include /home/acme/git/linux/include/linux/kconfig.h -I/home/acme/lib/include/perf/bpf -Wno-unused-value -Wno-pointer-sign -working-directory /lib/modules/4.17.0-rc5/build -c /home/acme/bpf/hello.c -target bpf -mllvm -mattr=dwarfris -O2 -o hello.o > > So onlye with 'clang ... -target bpf -emit-llvm -O2 -o - | llc -march=bpf -mattr=dwarfris ...' > things work as we expect. Right. Currently, the only way to use option -mattr=dwarfris is through llc. The "clang -mllvm -mattr=dwarfris" won't work since -mllvm Additional arguments to forward to LLVM's option processing and -mattr=dwarfris is not in LLVM auto option processing system. Those options, in llvm source code, typically have a pattern like below: === static cl::opt MemCmpEqZeroNumLoadsPerBlock( "memcmp-num-loads-per-block", cl::Hidden, cl::init(1), cl::desc("The number of loads per basic block for inline expansion of " "memcmp that is only being compared against zero.")); === 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. > - Arnaldo >