[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

Alexei Starovoitov via llvm-dev llvm-dev at lists.llvm.org
Wed Aug 5 23:50:02 PDT 2015


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 :)



More information about the llvm-dev mailing list