Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754822AbbHFGuI (ORCPT ); Thu, 6 Aug 2015 02:50:08 -0400 Received: from mail-pa0-f49.google.com ([209.85.220.49]:33657 "EHLO mail-pa0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754766AbbHFGuG (ORCPT ); Thu, 6 Aug 2015 02:50:06 -0400 Date: Wed, 5 Aug 2015 23:50:02 -0700 From: Alexei Starovoitov To: "Wangnan (F)" Cc: He Kuang , Alexei Starovoitov , 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: <20150806065001.GA52262@Alexeis-MBP.westell.com> References: <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> <20150806034125.GB52057@Alexeis-MBP.westell.com> <55C2E31E.7060407@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <55C2E31E.7060407@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 Content-Length: 960 Lines: 29 On Thu, Aug 06, 2015 at 12:31:26PM +0800, Wangnan (F) wrote: > > > What about hacking ELF binary in memory? > > 1. load the object into memory; > 2. twist the machine code to EM_X86_64; > 3. load it using elf_begin; > 4. return the twested elf memory image using libdwfl's find_elf callback. > > Then libdw will recognise BPF's object file as a X86_64 object file. If > required, > relocation sections can also be twisted in this way. Should not very hard > since > we can only consider one relocation type. > > Then let's start thinking how to introduce EM_BPF. We can rely on the > hacking > until EM_BPF symbol reaches elfutils in perf. > > What do you think? sounds crazy, but may work. let's try it :) -- 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/