aboutsummaryrefslogtreecommitdiff
path: root/ld/pe-dll.c
diff options
context:
space:
mode:
authorKai Tietz <kai.tietz@onevision.com>2011-04-13 12:53:36 +0000
committerKai Tietz <kai.tietz@onevision.com>2011-04-13 12:53:36 +0000
commitdb17156eaa6dbb38436c6a01712688e35389e773 (patch)
treed21e8952f2eee10e1e62512a1c98b7857c211bf5 /ld/pe-dll.c
parent7f880bc3d4d91558b61f7460dabacc04c0ed44a3 (diff)
downloadgdb-db17156eaa6dbb38436c6a01712688e35389e773.zip
gdb-db17156eaa6dbb38436c6a01712688e35389e773.tar.gz
gdb-db17156eaa6dbb38436c6a01712688e35389e773.tar.bz2
2011-04-13 Kai Tietz <ktietz@redhat.com>
PR binutils/12658 * deffile.h (def_file_add_export): Add is_dup argument. (def_file_add_import): Likewise. * deffilep.y (are_names_equal): New helper. (cmp_export_elem): New helper. (find_export_in_list): Add search routine for exports. (def_file_add_export): Check for duplicates. (cmp_import_elem): New helper. (find_import_in_list): Add search routine for imports. (def_file_add_import): Check for duplicates. (def_exports): Handle duplicates. (def_imports): Likewise. * pe-dll.c (process_def_file_and_drectve): Likewise. (pe_implied_import_dll): Likewise.
Diffstat (limited to 'ld/pe-dll.c')
-rw-r--r--ld/pe-dll.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/ld/pe-dll.c b/ld/pe-dll.c
index 7de718a..c8abf4d 100644
--- a/ld/pe-dll.c
+++ b/ld/pe-dll.c
@@ -751,10 +751,13 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (auto_export (b, pe_def_file, sn))
{
+ int is_dup = 0;
def_file_export *p;
- p=def_file_add_export (pe_def_file, sn, 0, -1, NULL);
+ p = def_file_add_export (pe_def_file, sn, 0, -1,
+ NULL, &is_dup);
/* Fill data flag properly, from dlltool.c. */
- p->flag_data = !(symbols[j]->flags & BSF_FUNCTION);
+ if (!is_dup)
+ p->flag_data = !(symbols[j]->flags & BSF_FUNCTION);
}
}
}
@@ -801,6 +804,7 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (strchr (pe_def_file->exports[i].name, '@'))
{
+ int is_dup = 1;
int lead_at = (*pe_def_file->exports[i].name == '@');
char *tmp = xstrdup (pe_def_file->exports[i].name + lead_at);
@@ -808,9 +812,9 @@ process_def_file_and_drectve (bfd *abfd ATTRIBUTE_UNUSED, struct bfd_link_info *
if (auto_export (NULL, pe_def_file, tmp))
def_file_add_export (pe_def_file, tmp,
pe_def_file->exports[i].internal_name,
- -1, NULL);
- else
- free (tmp);
+ -1, NULL, &is_dup);
+ if (is_dup)
+ free (tmp);
}
}
}
@@ -3146,6 +3150,7 @@ pe_implied_import_dll (const char *filename)
exported in buggy auto-import releases. */
if (! CONST_STRNEQ (erva + name_rva, "__nm_"))
{
+ int is_dup = 0;
/* is_data is true if the address is in the data, rdata or bss
segment. */
is_data =
@@ -3154,9 +3159,10 @@ pe_implied_import_dll (const char *filename)
|| (func_rva >= bss_start && func_rva < bss_end);
imp = def_file_add_import (pe_def_file, erva + name_rva,
- dllname, i, 0, NULL);
+ dllname, i, 0, NULL, &is_dup);
/* Mark symbol type. */
- imp->data = is_data;
+ if (!is_dup)
+ imp->data = is_data;
if (pe_dll_extra_pe_debug)
printf ("%s dll-name: %s sym: %s addr: 0x%lx %s\n",