diff options
author | Kai Tietz <kai.tietz@onevision.com> | 2009-11-15 07:52:45 +0000 |
---|---|---|
committer | Kai Tietz <kai.tietz@onevision.com> | 2009-11-15 07:52:45 +0000 |
commit | 8a9eab9b5ee88bda4d83a237e3a3c0723530a51e (patch) | |
tree | 75ee2031c97719adc6fd7cb6001988d9b5b06937 /ld/pe-dll.c | |
parent | 213fc0adc404177897e213e99b8f231dd10d9ead (diff) | |
download | gdb-8a9eab9b5ee88bda4d83a237e3a3c0723530a51e.zip gdb-8a9eab9b5ee88bda4d83a237e3a3c0723530a51e.tar.gz gdb-8a9eab9b5ee88bda4d83a237e3a3c0723530a51e.tar.bz2 |
2009-11-15 Kai Tietz <kai.tietz@onevision.com>
* pe-dll.c (pe_undef_alias_cdecl_match): New function.
(pe_find_cdecl_alias_match): New function.
(pe_process_import_defs): Add matching for import symbols
declared as cdecl for fastcall/stdcall.
* emultempl/pe.em (pe_undef_cdecl_match): Treat fastcall
symbols, too.
(pe_fixup_stdcalls): Likewise.
(gld_XXX_after_open): Redo scanning for imported
fastcall/stdcall symbols as cdecl one.
* emultempl/pep.em (pep_undef_cdecl_match): Treat fastcall
symbols, too.
(pep_fixup_stdcalls): Likewise.
(gld_XXX_after_open): Redo scanning for imported
fastcall/stdcall symbols as cdecl one.
2009-11-15 Kai Tietz <kai.tietz@onevision.com>
* ld-pe/direct2_client.c: New file.
* ld-pe/direct2_dll.c: Likewise.
* ld-pe/direct2_dll.def: Likewise.
* ld-pe/pe-run2.exp: Likewise.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r-- | ld/pe-dll.c | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c index dbf1b5e..beeb580 100644 --- a/ld/pe-dll.c +++ b/ld/pe-dll.c @@ -2761,6 +2761,37 @@ pe_dll_generate_implib (def_file *def, const char *impfilename, struct bfd_link_ } } +static struct bfd_link_hash_entry *found_sym; + +static bfd_boolean +pe_undef_alias_cdecl_match (struct bfd_link_hash_entry *h, void *inf) +{ + int sl; + char *string = inf; + const char *hs = h->root.string; + + sl = strlen (string); + if (h->type == bfd_link_hash_undefined + && ((*hs == '@' && *string == '_' + && strncmp (hs + 1, string + 1, sl - 1) == 0) + || strncmp (hs, string, sl) == 0) + && h->root.string[sl] == '@') + { + found_sym = h; + return FALSE; + } + return TRUE; +} + +static struct bfd_link_hash_entry * +pe_find_cdecl_alias_match (char *name) +{ + found_sym = 0; + bfd_link_hash_traverse (link_info.hash, pe_undef_alias_cdecl_match, + (char *) name); + return found_sym; +} + static void add_bfd_to_link (bfd *abfd, const char *name, struct bfd_link_info *link_info) { @@ -2808,6 +2839,9 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) size_t len = strlen (pe_def_file->imports[i].internal_name); char *name = xmalloc (len + 2 + 6); bfd_boolean include_jmp_stub = FALSE; + bfd_boolean is_cdecl = FALSE; + if (!lead_at && strchr (pe_def_file->imports[i].internal_name, '@') == NULL) + is_cdecl = TRUE; if (lead_at) sprintf (name, "%s", @@ -2836,6 +2870,14 @@ pe_process_import_defs (bfd *output_bfd, struct bfd_link_info *link_info) else include_jmp_stub = TRUE; + if (is_cdecl && !blhe) + { + sprintf (name, "%s%s",U (""), + pe_def_file->imports[i].internal_name); + blhe = pe_find_cdecl_alias_match (name); + include_jmp_stub = TRUE; + } + free (name); if (blhe && blhe->type == bfd_link_hash_undefined) |