Fixed the RELA handling in the merging of the object sections into the
RAP sections. A method in the rap::image class was not being used any
more and that code transferred the RELA setting from the object sections
to the image section. This change adds also transfers the rela field.
The offsets of sections in objects have to be computed in load order
so the offsets work. For example an object could have a sections with
an alignment of 4 and 16 so the 4 may align with the current load
offset and the 16 is padded to align it. This is the way the image is
loaded and so the layout needs to follow these rules.
The strtab search needs to be better. An STL string find was finding
patrial strings and causing errors on the target.
Weak symbols where not being managed correctly. The symbols table
is now a class with externals and weaks as separate symtabs so
the externals can be searched first then the weaks and if not
found an unresolved error is raised. This was found creating
a libbsdport RAP file where the drivers in the all driver table
resolved to the weak symbols and so linking in nothing.
Fixing the weak symbols as found in the libbsdport library
triggered a new resolver bug. The object files now contain the
resolver state and this is used to determine if an object file
has been resolved or is currently being resolved avoiding
rescursive loops with dependent object files.
The resolver trace output is a little easier to read.
Moved the section trace output to after the offsets have been
computed and add this to the output. This allows a simple way
to track the offset in an ELF section to the offset in the RAP
section.
An overlay shows the hex dump of the section data with the relocation
records so you can see the relationship between the relocations and
the section data.
Set the compressed file length in the RAP header. Move
the string from the outputter to the RAP file.
Make the sections public by moving to the RAP header.
Make reading compressed files more robust returning the amount
of data that can be read. Also add >> operartors to get the
data. Add exceptions when a read fails.
Support has been added to load relocation record on demand. The
relocation records are not read when the object file is first
opened and read. They are read only when being written to the
output file. This save loading lots of records into memory
from libraries to be thrown away.
The RAP format now supports writing out relocation records.
Do not write the script into the RAP file rather just write the
init and fini labels. These are appended to the string table and
offsets in the string table added to the image.
Fi the sizes so the sections can be correctly loaded on the target.
The file is a header and a searies of LZ77 blocks which hold the
application. The format allows for easy streaming and loading
on the target without needing the rewind or seek around the
file.