aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorMartin Storsjö <martin@martin.st>2022-09-02 12:22:29 +0300
committerMartin Storsjö <martin@martin.st>2022-09-12 11:07:35 +0300
commita33a94cf432e449461b7ddcc22b6f5a886cd3315 (patch)
tree8bb88e797733fc5803784465d455f397a2d85d3d /ld/pe-dll.c
parent3d36a6396fbfacd7b1941527d84ff6c0f40ff121 (diff)
downloadgdb-a33a94cf432e449461b7ddcc22b6f5a886cd3315.zip
gdb-a33a94cf432e449461b7ddcc22b6f5a886cd3315.tar.gz
gdb-a33a94cf432e449461b7ddcc22b6f5a886cd3315.tar.bz2
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.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index fbf180e..60584a8 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -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);
}
}