This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Incremental linking output file editing support
- From: Mikolaj Zalewski <mikolajz at google dot com>
- To: binutils at sourceware dot org
- Date: Thu, 20 Aug 2009 19:04:54 +0200
- Subject: Incremental linking output file editing support
I have been looking where to add support for reading/editing the
output file in an incremental build. It seems the current classes
don't fit well and I would need to duplicate some code. However,
before coding, it is probably better to ask if there is not a better
solution. I need:
- A class to handle file reading/writing. Extending File_read for
writing would be problematic because it assumes there is only one
reader and has on synchronization inside. For incremental linking of a
file we may want to access different section by different threads in
parallel. Do we want to extend File_read to have writing and two
different locking models, or should I create a new class (or extend
Output_file)? In the second case, maybe some common code could be
moved to a common ancestor. As a separate question, do we want to mmap
only the necessary fragments of memory of output file (like we do in
File_read), or can we mmap the whole file (assuming that if we blow up
the address space because of this then we will also blow it up during
a full link and gold will not be useful for this binary).
- A class representing the ELF output file with support for reading
and writing. I could subclass the Object but it seems to be oriented
for input objects, e.g. I would need to fake an Input_file object to
create an Object. It contains boilerplate code for Elf_file over
File_read support, what is helpful if we decide to extend File_read
for writing but could be a problem otherwise. So, especially if we
don't extend File_read, it may be cleaner to create a new class having
a Elf_file member. If there is some code in Object of Sized_relobj
that would be useful, I could try to move it to elfcpp.
Are there some ways to reuse existing components that I've missed?
MikoÅaj