aboutsummaryrefslogtreecommitdiff
path: root/bfd/cofflink.c
diff options
context:
space:
mode:
authorLuca Bacci <luca.bacci@outlook.com>2023-05-17 13:38:14 +0100
committerNick Clifton <nickc@redhat.com>2023-05-17 13:38:14 +0100
commit80d4e113d7b9af8a5a36e5ea4399bca86050784f (patch)
treea471fa8b0176805e795dd73a3a97b5af94630482 /bfd/cofflink.c
parent80b6c32f233ed28607643c4e4e4e2ee3399fdfd7 (diff)
downloadbinutils-80d4e113d7b9af8a5a36e5ea4399bca86050784f.zip
binutils-80d4e113d7b9af8a5a36e5ea4399bca86050784f.tar.gz
binutils-80d4e113d7b9af8a5a36e5ea4399bca86050784f.tar.bz2
Decorated symbols in import libs (BUG 30421)
PR 30421 * cofflink.c (_decoration_hash_newfunc): New function. (_bfd_coff_link_hash_table_init): Call it. * libcoff-in.h (struct coff_link_hash_table): Add decoration_hash field. (struct decoration_hash_entry): Declare. (_decoration_hash_newfunc): Prototype. * libcoff.h: Regenerate. * emultempl/pe.em (set_decoration): New function. (pe_fixup_stdcalls): Call the new function. * emultempl/pep.em (set_decoration): New function. (pep_fixup_stdcalls): Call the new function. * pe-dll.c (make_one): Check for decoated symbols.
Diffstat (limited to 'bfd/cofflink.c')
-rw-r--r--bfd/cofflink.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/bfd/cofflink.c b/bfd/cofflink.c
index 9baec2f..24c4a2b 100644
--- a/bfd/cofflink.c
+++ b/bfd/cofflink.c
@@ -89,6 +89,34 @@ _bfd_coff_link_hash_newfunc (struct bfd_hash_entry *entry,
return (struct bfd_hash_entry *) ret;
}
+struct bfd_hash_entry *
+_decoration_hash_newfunc (struct bfd_hash_entry *entry,
+ struct bfd_hash_table *table,
+ const char *string)
+{
+ struct decoration_hash_entry *ret = (struct decoration_hash_entry *) entry;
+
+ /* Allocate the structure if it has not already been allocated by a
+ subclass. */
+ if (ret == NULL)
+ {
+ ret = (struct decoration_hash_entry *)
+ bfd_hash_allocate (table, sizeof (struct decoration_hash_entry));
+ if (ret == NULL)
+ return NULL;
+ }
+
+ /* Call the allocation method of the superclass. */
+ ret = (struct decoration_hash_entry *)
+ _bfd_link_hash_newfunc ((struct bfd_hash_entry *) ret, table, string);
+ if (ret != NULL)
+ {
+ ret->decorated_link = NULL;
+ }
+
+ return (struct bfd_hash_entry *) ret;
+}
+
/* Initialize a COFF linker hash table. */
bool
@@ -100,7 +128,11 @@ _bfd_coff_link_hash_table_init (struct coff_link_hash_table *table,
unsigned int entsize)
{
memset (&table->stab_info, 0, sizeof (table->stab_info));
- return _bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
+
+ return bfd_hash_table_init (&table->decoration_hash,
+ _decoration_hash_newfunc,
+ sizeof (struct decoration_hash_entry))
+ &&_bfd_link_hash_table_init (&table->root, abfd, newfunc, entsize);
}
/* Create a COFF linker hash table. */