2001-08-02 Paul Sokolovsky <paul.sokolovsky@technologist.com>
authorCharles Wilson <cygwin@cwilson.fastmail.fm>
Thu, 2 Aug 2001 23:05:54 +0000 (23:05 +0000)
committerCharles Wilson <cygwin@cwilson.fastmail.fm>
Thu, 2 Aug 2001 23:05:54 +0000 (23:05 +0000)
        * cofflink.c (coff_link_check_ar_symbols): also search for
        __imp__symbol as well as _symbol.
        * linker.c (_bfd_generic_link_add_archive_symbols): also
        search for __imp__symbol as well as _symbol.

bfd/ChangeLog
bfd/cofflink.c
bfd/linker.c

index 71208e52c69886cc8f52e4561cdc7ec15eb8b4b3..35a2fad46d0314a93458a5021689d5cf925843c9 100644 (file)
@@ -1,3 +1,10 @@
+2001-08-02  Paul Sokolovsky  <paul.sokolovsky@technologist.com>
+
+       * cofflink.c (coff_link_check_ar_symbols): also search for
+       __imp__symbol as well as _symbol.
+       * linker.c (_bfd_generic_link_add_archive_symbols): also
+       search for __imp__symbol as well as _symbol.
+
 2001-08-01  Adam Nemet  <anemet@lnxw.com>
 
        * elf.c (elf_sort_sections): Return zero only as the last step.
index 47716ac2eaea8b0fcbacd6fb42568d57b8a98a02..e6dcd88edc17670b832e6974bb8127d937081c0f 100644 (file)
@@ -277,6 +277,16 @@ coff_link_check_ar_symbols (abfd, info, pneeded)
            return false;
          h = bfd_link_hash_lookup (info->hash, name, false, false, true);
 
+         /* auto import */
+         if (!h && info->pei386_auto_import)
+           {
+             if (!strncmp (name,"__imp_", 6))
+               {
+                 h =
+                    bfd_link_hash_lookup (info->hash, name + 6, false, false,
+                                          true);
+               }
+           }
          /* We are only interested in symbols that are currently
             undefined.  If a symbol is currently known to be common,
             COFF linkers do not bring in an object file which defines
index 54781868e7ab2c837be64f301c5326027abada48..1144e92dbfc2e54dc5a6e0c472e657f4cc47439b 100644 (file)
@@ -1003,10 +1003,20 @@ _bfd_generic_link_add_archive_symbols (abfd, info, checkfn)
       arh = archive_hash_lookup (&arsym_hash, h->root.string, false, false);
       if (arh == (struct archive_hash_entry *) NULL)
        {
-         pundef = &(*pundef)->next;
-         continue;
+         /* If we haven't found the exact symbol we're looking for, 
+            let's look for its import thunk */
+         if (info->pei386_auto_import)
+           {
+             char *buf = alloca (strlen (h->root.string) + 10);
+             sprintf (buf, "__imp_%s", h->root.string);
+             arh = archive_hash_lookup (&arsym_hash, buf, false, false);
+           }
+         if (arh == (struct archive_hash_entry *) NULL)
+           {
+             pundef = &(*pundef)->next;
+             continue;
+           }
        }
-
       /* Look at all the objects which define this symbol.  */
       for (l = arh->defs; l != (struct archive_list *) NULL; l = l->next)
        {