aboutsummaryrefslogtreecommitdiff
path: root/ld/emultempl
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2003-12-18 14:56:44 +0000
committerNick Clifton <nickc@redhat.com>2003-12-18 14:56:44 +0000
commit44dbf3639f127af46d569ad96b6242dfbc4c0a89 (patch)
treecbe2aa086f0a7aeaeacaa1972d2b94222f156a59 /ld/emultempl
parent18ab192184fb5f5c087651ac8fdfe2b3f1cdf720 (diff)
downloadgdb-44dbf3639f127af46d569ad96b6242dfbc4c0a89.zip
gdb-44dbf3639f127af46d569ad96b6242dfbc4c0a89.tar.gz
gdb-44dbf3639f127af46d569ad96b6242dfbc4c0a89.tar.bz2
When scanning MS import libraries allow for the possible presence of static
objects.
Diffstat (limited to 'ld/emultempl')
-rw-r--r--ld/emultempl/pe.em51
1 files changed, 45 insertions, 6 deletions
diff --git a/ld/emultempl/pe.em b/ld/emultempl/pe.em
index bc21bc5..38120b1 100644
--- a/ld/emultempl/pe.em
+++ b/ld/emultempl/pe.em
@@ -1115,6 +1115,7 @@ gld_${EMULATION_NAME}_after_open (void)
int is_ms_arch = 0;
bfd *cur_arch = 0;
lang_input_statement_type *is2;
+ lang_input_statement_type *is3;
/* Careful - this is a shell script. Watch those dollar signs! */
/* Microsoft import libraries have every member named the same,
@@ -1129,21 +1130,59 @@ gld_${EMULATION_NAME}_after_open (void)
{
if (is->the_bfd->my_archive)
{
+ char *pnt;
bfd *arch = is->the_bfd->my_archive;
+
if (cur_arch != arch)
{
cur_arch = arch;
is_ms_arch = 1;
- for (is2 = is;
- is2 && is2->the_bfd->my_archive == arch;
- is2 = (lang_input_statement_type *)is2->next)
+
+ for (is3 = is;
+ is3 && is3->the_bfd->my_archive == arch;
+ is3 = (lang_input_statement_type *) is3->next)
+ {
+ /* A MS dynamic import library can also contain static
+ members, so look for the first element with a .dll
+ extension, and use that for the remainder of the
+ comparisons. */
+ pnt = strrchr (is3->the_bfd->filename, '.');
+ if (pnt != NULL && strcmp (pnt, ".dll") != 0)
+ continue;
+ }
+
+ if (is3 == NULL)
+ is_ms_arch = 0;
+ else
{
- if (strcmp (is->the_bfd->filename, is2->the_bfd->filename))
- is_ms_arch = 0;
+ /* OK, found one. Now look to see if the remaining
+ (dynamic import) members use the same name. */
+ for (is2 = is;
+ is2 && is2->the_bfd->my_archive == arch;
+ is2 = (lang_input_statement_type *) is2->next)
+ {
+ /* Skip static members, ie anything with a .obj
+ extension. */
+ pnt = strrchr (is2->the_bfd->filename, '.');
+ if (pnt != NULL && strcmp (pnt, ".obj") == 0)
+ continue;
+
+ if (strcmp (is3->the_bfd->filename,
+ is2->the_bfd->filename))
+ {
+ is_ms_arch = 0;
+ break;
+ }
+ }
}
}
- if (is_ms_arch)
+ /* This fragment might have come from an .obj file in a Microsoft
+ import, and not an actual import record. If this is the case,
+ then leave the filename alone. */
+ pnt = strrchr (is->the_bfd->filename, '.');
+
+ if (is_ms_arch && (strcmp (pnt, ".dll") == 0))
{
int idata2 = 0, reloc_count=0;
asection *sec;