gold patch committed: add --preread-archive-symbols option
Cary Coutant
ccoutant@google.com
Thu Aug 7 17:14:00 GMT 2008
This patch adds a --preread-archive-symbols option to gold. This
option, when --threads is also enabled, causes gold to pre-read all
the symbols in an archive library in order to improve parallelization.
When processing ordinary object files, gold reads the symbols into
memory in parallel, then serializes the process of adding each object
file's symbols to the symbol table. For archives, however, it had to
read the symbols then add the symbols from each archive member in turn
as it went through the archive symbol index. With this new option, it
will read the symbols from every member speculatively, serializing
only when it's time to add symbols to the symbol table. This seems to
be a win as long as a significant fraction of archive members are
actually selected for linking.
This patch was approved by Ian offline.
-cary
2008-08-06 Cary Coutant <ccoutant@google.com>
* archive.cc (Archive::total_archives, Archive::total_members)
(Archive::total_members_loaded): New variables.
(Archive::setup): Add parameter. Add option to preread
archive symbols.
(Archive::read_armap): Add counter.
(Archive::get_file_and_offset): New function.
(Archive::get_elf_object_for_member): New function.
(Archive::read_all_symbols): New function.
(Archive::read_symbols): New function.
(Archive::add_symbols): Add counters.
(Archive::include_all_members): Use armap to find members if it's
already built.
(Archive::include_member): Skip reading symbols if already read.
Factored code into Archive::get_file_and_offset and
Archive::get_elf_object_for_member. Changed call to
Mapfile::report_include_archive_member.
(Archive::print_stats): New function.
* archive.h: Declare Object and Read_symbols_data classes.
(Archive::Archive): Add initializers for new members.
(Archive::setup): Add parameter.
(Archive::print_stats): New function.
(Archive::total_archives, Archive::total_members)
(Archive::total_members_loaded): New variables.
(Archive::get_file_and_offset): New function.
(Archive::get_elf_object_for_member): New function.
(Archive::read_all_symbols): New function.
(Archive::read_symbols): New function.
(Archive::Archive_member): New class.
(Archive::members_): New member.
(Archive::num_members_): New member.
* main.cc: Include archive.h.
(main): Call Archive::print_stats.
* mapfile.cc (Mapfile::report_include_archive_member): Delete
archive parameter; member_name is now the fully-decorated name.
* mapfile.h (Mapfile::report_include_archive_member): Likewise.
* options.h: (General_options): Add --preread-archive-symbols option.
* readsyms.cc (Read_symbols::do_read_symbols): Change call to
Archive::setup.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: preread-patch-g.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20080807/bae994ce/attachment.txt>
More information about the Binutils
mailing list