[llvm-commits] Code refactoring of MCELFStreamer.cpp and ELFObjectWriter.cpp

Jan Sjodin jan_sjodin at yahoo.com
Mon Feb 28 09:49:22 PST 2011


I was trying to commit my change, but something is wrong. It was the first time 
I tried to commit anything so something was bound to not work. :) I will try to 
get some help, but if you want to commit it, go ahead.

- Jan



----- Original Message ----
> From: Rafael Ávila de Espíndola <rafael.espindola at gmail.com>
> To: Jan Sjodin <jan_sjodin at yahoo.com>
> Cc: llvm-commits at cs.uiuc.edu
> Sent: Sat, February 26, 2011 10:10:16 AM
> Subject: Re: [llvm-commits] Code refactoring of MCELFStreamer.cpp and 
>ELFObjectWriter.cpp
> 
> On 11-02-25 8:54 PM, Jan Sjodin wrote:
> > The JIT implementation I am  working on (MCJIT which was renamed to JunkJIT)
> > became a lot nicer when  I decided to inherit MCELFStreamer and 
>ELFObjectWriter.
> > This was needed  to make the debug information available to gdb since it 
>expects
> > ELF  format. I basically reuse everything, the only thing that differs is 
>that  I
> > use a mem_raw_outstream to emit code to memory and make sure that all  
>sections
> > are created before or during the post layout binding so that  when
> > RecordRelocation is called all symbol addresses are known. In  the
> > ELFObjectWriter, the code in WriteObject that creates sections is  moved to 
>the
> > post layout binding, and the code that emits the object  stays in place. This 
>is
> > perhaps not very clean, since it is not  formalized in the interface, but it
> > works okay and I only need to  shuffle around the code a little. You could
> > imagine that if section  creation was restricted by the interface to only
> > happenen before/during  post layout, then a generic JunkJIT could be written 
>for
> > any object  format. Each object writer would be required to compute offsets 
>for
> > the  sections. I am currently not aiming to do this since the MCJIT proposal  
>by
> > Daniel separates the Streamer/ObjectWriter from figuring out  relocations 
and
> > external symbols. However, the code refactoring patches  I have/will submit 
>are
> > fairly benign and enable a JIT (without lazy  compilation) using the MC
> > framework.
> 
> Cool. The rafactoring patch  is OK.
> 
> > - Jan
> >
> 
> Cheers,
> Rafael
> 




More information about the llvm-commits mailing list