aboutsummaryrefslogtreecommitdiff
path: root/bfd/peicode.h
diff options
context:
space:
mode:
authorOleg Tolmatcev <oleg.tolmatcev@gmail.com>2023-06-18 19:35:38 +0200
committerAlan Modra <amodra@gmail.com>2023-08-24 15:54:39 +0930
commit6aadf8a04d162feb2afe3c41f5b36534d661d447 (patch)
tree1f4e29669179cb6ff3e0c1e5e50ad2006b99c833 /bfd/peicode.h
parentfb9b7fbf17f50fcfabf6e3d7d06a93e1f17c52b7 (diff)
downloadgdb-6aadf8a04d162feb2afe3c41f5b36534d661d447.zip
gdb-6aadf8a04d162feb2afe3c41f5b36534d661d447.tar.gz
gdb-6aadf8a04d162feb2afe3c41f5b36534d661d447.tar.bz2
optimize handle_COMDAT
Signed-off-by: Oleg Tolmatcev <oleg.tolmatcev@gmail.com>
Diffstat (limited to 'bfd/peicode.h')
-rw-r--r--bfd/peicode.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/bfd/peicode.h b/bfd/peicode.h
index 2cd020e..5ac6b0d 100644
--- a/bfd/peicode.h
+++ b/bfd/peicode.h
@@ -255,6 +255,21 @@ coff_swap_scnhdr_in (bfd * abfd, void * ext, void * in)
#endif
}
+static hashval_t
+htab_hash_flags (const void *entry)
+{
+ const struct comdat_hash_entry *fe = entry;
+ return fe->target_index;
+}
+
+static int
+htab_eq_flags (const void *e1, const void *e2)
+{
+ const struct comdat_hash_entry *fe1 = e1;
+ const struct comdat_hash_entry *fe2 = e2;
+ return fe1->target_index == fe2->target_index;
+}
+
static bool
pe_mkobject (bfd * abfd)
{
@@ -291,6 +306,8 @@ pe_mkobject (bfd * abfd)
pe->dos_message[14] = 0x24;
pe->dos_message[15] = 0x0;
+ pe->comdat_hash = htab_create (10, htab_hash_flags, htab_eq_flags, NULL);
+
memset (& pe->pe_opthdr, 0, sizeof pe->pe_opthdr);
bfd_coff_long_section_names (abfd)