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

Rafael Ávila de Espíndola rafael.espindola at gmail.com
Sat Feb 26 07:10:16 PST 2011


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