From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754384AbbHFDlb (ORCPT ); Wed, 5 Aug 2015 23:41:31 -0400 Received: from mail-pa0-f53.google.com ([209.85.220.53]:36490 "EHLO mail-pa0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753072AbbHFDl3 (ORCPT ); Wed, 5 Aug 2015 23:41:29 -0400 Date: Wed, 5 Aug 2015 20:41:26 -0700 From: Alexei Starovoitov To: He Kuang Cc: Alexei Starovoitov , "Wangnan (F)" , pi3orama , llvm-dev@lists.llvm.org, "linux-kernel@vger.kernel.org" Subject: Re: [llvm-dev] [LLVMdev] Cc llvmdev: Re: llvm bpf debug info. Re: [RFC PATCH v4 3/3] bpf: Introduce function for outputing data to perf event Message-ID: <20150806034125.GB52057@Alexeis-MBP.westell.com> References: <55A88449.3030008@plumgrid.com> <55B0D5FC.6050406@huawei.com> <55B1535E.8090406@plumgrid.com> <55B1AEE9.1080207@plumgrid.com> <55B1BC03.9020708@huawei.com> <55B35F42.70803@huawei.com> <55B6E685.30905@plumgrid.com> <55B89F04.5030304@huawei.com> <55B909B2.2080606@plumgrid.com> <55C1D055.2050205@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55C1D055.2050205@huawei.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 On Wed, Aug 05, 2015 at 04:59:01PM +0800, He Kuang wrote: > Hi, Alexei > > On 2015/7/30 1:13, Alexei Starovoitov wrote: > >On 7/29/15 2:38 AM, He Kuang wrote: > >>Hi, Alexei > >> > >>On 2015/7/28 10:18, Alexei Starovoitov wrote: > >>>On 7/25/15 3:04 AM, He Kuang wrote: > >>>>I noticed that for 64-bit elf format, the reloc sections have > >>>>'Addend' in the entry, but there's no 'Addend' info in bpf elf > >>>>file(64bit). I think there must be something wrong in the process > >>>>of .s -> .o, which related to 64bit/32bit. Anyway, we can parse out the > >>>>AT_name now, DW_AT_LOCATION still missed and need your help. > >>> > > Another thing about DW_AT_name, we've already found that the name > string is stored indirectly and needs relocation which is > architecture specific, while the e_machine info in bpf obj file > is "unknown", both objdump and libdw cannot parse DW_AT_name > correctly. > > Should we just use a known architeture for bpf object file > instead of "unknown"? If so, we can use the existing relocation > codes in libdw and get DIE name by simply invoking > dwarf_diename(). The drawback of this method is that, e.g. we > use "x86-64" instead, is hard to distinguish bpf obj file with > x86-64 elf file. Do you think this is ok? The only clean way would be to register bpf as an architecture with elf standards committee. I have no idea who is doing that and how much such new e_machine registration may cost. So far using EM_NONE is a hack to avoid bureaucracy. Are dwarf relocation processor specific? Then simple hack to elfutils/libdw to treat EM_NONE as X64 should do the trick, right? If that indeed works, we can tweak bpf backend to use EM_X86_64, but then the danger that such .o file will be wrongly recognized by elf utils. imo it's safer to keep it as EM_NONE until real number is assigned, but even after it's assigned it will take time to propagate that value. So for now I would try to find a solution keeping EM_NONE hack.