Major refactoring of ElfBuilder.

Simplify ElfBuilder by removing duplicated or redundant code.
Many of the repeated code patterns were replaced by just
looping over the list of all sections.

Methods Init() and Write() have been merged into one.
The split between those was rather arbitrary, but it was there
for a reason.  It allowed creation of raw sections between
the calls which may have depended on layout decisions done in
Init(), but not in Write() (e.g. knowing of offset of .text).

This has been replaced by more generic solution.
All sections are asked about their size first and complete
file layout is calculated.  Then the sections are asked to
write their content (potentially using the layout information).

This should be pure refactoring CL - the compiler should
produce bit for bit identical output as before.

Change-Id: I281d13d469801bd8288b36b360d200d98a3e92d7
6 files changed