[LLVMdev] [lld] Atom object model refactoring.

Michael Spencer bigcheesegs at gmail.com
Wed Jul 18 12:52:39 PDT 2012


I've run into some issues with the current atom object model that I
would like to fix.

The current 4 atoms are not expressive enough. We need to be able to
serialize a larger set of atoms, many of which are format specific.

The set of common atoms (shared between all formats) should be the set
that the resolver requires to work. SharedLibrary is not included in
this (by looking at the source code).

The driving use case for this for me is the Import Address Table in
PE/COFF. It is a section created by the writer that specifies external
symbols to import and then acts as the GOT/PLT at runtime. Building
this table requires extra information to be maintained in an efficient
format. It also needs to be an atom so that relocations can point to
it. However it does not have a well defined size or content until the
table is complete.

The File interface for atoms should be changed to File::iterator
begin(); File::iterator end(); where File::iterator is some type of
iterator over Atom.

As for serialization. Each atom can have its own serialize/unserialize
function for both the Native format and YAML.

This would also change ContentType to not contain so many format
specific values. It would also allow us to get rid of isThumb as a
DefinedAtom level attribute.

- Michael Spencer



More information about the llvm-dev mailing list