ld: pe: Improve performance of object file exclude symbol directives

Store the list of excluded symbols in a sorted list, speeding up
checking for duplicates when inserting new entries.

This is done in the same way as is done for exports and imports
(while the previous implementation was done with a linked list,
based on the implementation for aligncomm).

When linking object files with excluded symbols, there can potentially
be very large numbers of excluded symbols (just like builds with
exports can have a large number of exported symbols).

This improves the link performance somewhat, when linking with large
numbers of excluded symbols.

The later actual use of the excluded symbols within pe-dll.c
handles them via an unordered linked list still, though.
This commit is contained in:
Martin Storsjö
2022-09-02 12:22:29 +03:00
parent 3d36a6396f
commit a33a94cf43
3 changed files with 99 additions and 35 deletions

View File

@@ -671,6 +671,7 @@ static void
process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *info)
{
int i, j;
unsigned int ui;
struct bfd_link_hash_entry *blhe;
bfd *b;
struct bfd_section *s;
@@ -720,11 +721,10 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (pe_def_file->exclude_symbols)
{
def_file_exclude_symbol *ac = pe_def_file->exclude_symbols;
while (ac)
for (ui = 0; ui < pe_def_file->num_exclude_symbols; ui++)
{
pe_dll_add_excludes (ac->symbol_name, EXCLUDESYMS);
ac = ac->next;
pe_dll_add_excludes (pe_def_file->exclude_symbols[ui].symbol_name,
EXCLUDESYMS);
}
}