[gold][patch] Record the number of members in an archive

Rafael Espindola espindola@google.com
Mon Nov 30 22:48:00 GMT 2009


This is mostly an work in progress patch and I can split it a bit if
desired. In particular, the fixes for the typos and
Incremental_inputs_write can go in an independent patch.

What this patch does:

*) Fix typos in incremental-dump.cc and extend it a bit. A
Incremental_inputs_read is probably needed as it is getting
complicated.
*) Define readers and writers for archive information
*) Define an Archive_info structure. This is what
Incremental_inputs::report_archive records. For now it is just the
member count.
*) Define a Incremental_inputs_write class. This is a helper for
sized_create_inputs_section_data. Its main job is to compute and store
the layout of the incremental_inputs section.
*) Allocate space for archive and archive members
*) Write the member count
*) Write 0 as the offset of script files.

Particular items I would like feedback on:

*) In what order should the archive info be placed in the output? My
understanding is that it is not important since we always get to it
via a input file entry.

*) Incremental_inputs_write is implemented to be used with two passes
over the inputs. With this design it is possible to avoid additional
memory allocation.

Some alternatives:

*) Change it to resize the buffer as needed. This would allow us to do
a single pass over the inputs, but I am not sure if it would actually
be faster.

*) Spilt a Incremental_inputs_layout class out of it. This class would
not keep the buffer, just the counters necessary to find the size of
each part of the section. This classs could be updated from
incremental_inputs::report_*. I think that with this change
sized_create_inputs_section_data can be written to do a single pass
over the inputs and not use additional memory.

2009-11-30  Rafael Avila de Espindola  <espindola@google.com>

	* incremental-dump.cc (main): Fix typos. Print archive member count.
	* incremental.cc (Incremental_inputs_archive_header,
	Incremental_inputs_archive_header_write,
	Incremental_inputs_archive_member,
	Incremental_inputs_archive_member_write): New.
	(Incremental_inputs::report_archive): Record the member count.
	(Incremental_inputs_write): New.
	(Incremental_inputs::sized_create_inputs_section_data): Use
	Incremental_inputs_write. Write the archive member count.
	* incremental.h (Incremental_inputs_archive_header_data,
	Incremental_inputs_archive_member_data, Archive_info): New.
	(Input_info): Use Archive_info.

Cheers,
-- 
Rafael Ávila de Espíndola
-------------- next part --------------
A non-text attachment was scrubbed...
Name: archive.patch
Type: text/x-diff
Size: 13941 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/binutils/attachments/20091130/cfd8ed22/attachment.bin>


More information about the Binutils mailing list