[LLVMdev] ELF / COFF Summary

Chris Lattner sabre at nondot.org
Thu Jun 16 22:22:38 PDT 2005


On Wed, 15 Jun 2005, Reid Spencer wrote:
> So, here's the plan:
>
> 1. No reading interface. To have a system agnostic interface for reading
> a dynamic library, use System/DynamicLibrary. No plans for reading a
> native object file for any kind of examination purpose (at least, not
> for a long while).

Sounds good.

> 2. We will support .so/.dll and .o/.obj file output. There will be no
> support for .exe or .a output.

Sounds good.

> 3. The interface will deal with ELF and COFF output separately with
> separate interfaces for them.

Sounds good.

> 4. If Chris will expound on his design for the way to implement
> TargetMachine::addPassesToEmitObject, that sounds like a good way to go.
> However, doesn't this mean the ELF/COFF interfaces should be at the same
> level? I'm looking at the X86/X86CodeEmitter.cpp file and the various
> methods for emitting instructions/blocks/addresses/etc. Shouldn't the
> ELF/COFF interfaces be somewhat similar?

I don't think it should be templated at all.  Basically we want an 
interface that is like the AsmPrint interface described here:
include/llvm/CodeGen/AsmPrinter.h

Targets use this interface by deriving from AsmWriter, then filling in the 
various fields in the derived ctor.  You can see examples of this in the 
X86 and PPC backend.

In the case of the ELF writer, we want a similar structure.  Anything that 
can be simple exposed as data should be (e.g. whether the target is 32- or 
64-bit), anything more complex should be exposed as virtual methods that 
are overloaded.  The ELF spec makes it very clear what parts of the file 
format are common across targets and what the variations are caused by.

> 5. I have libELF building under LLVM. Its in lib/ObjCode/ELF (new).
> Should I commit it?

What does it do, how is it structured?  Can you email out the interface 
for feedback?  I would suggest lib/CodeGen/ELFWriter or something similar, 
since it is effectively a part of the target-independent code generator.

-Chris

-- 
http://nondot.org/sabre/
http://llvm.cs.uiuc.edu/




More information about the llvm-dev mailing list