* ldlang.c (wild): Handle foo.a(.text) by mapping each included
authorIan Lance Taylor <ian@airs.com>
Mon, 4 Mar 1996 19:12:43 +0000 (19:12 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 4 Mar 1996 19:12:43 +0000 (19:12 +0000)
member of foo.a separately.  From Jouke Numan <jnuman@bazis.nl>.

ld/ChangeLog
ld/ldlang.c

index 37b48f472c6ee0e9a3f77c81e77ea5dd79eeeafe..31f1b21d7b6c82ae4be3807bf5982519f2b0cce7 100644 (file)
@@ -1,3 +1,8 @@
+Mon Mar  4 14:11:17 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * ldlang.c (wild): Handle foo.a(.text) by mapping each included
+       member of foo.a separately.  From Jouke Numan <jnuman@bazis.nl>.
+
 Fri Mar  1 10:24:59 1996  Andreas Schwab  <schwab@issan.informatik.uni-dortmund.de>
 
        * emultempl/elf32.em (gld${EMULATION_NAME}_find_exp_assignment):
index 2c67d274f9265218192831010be25b39a8c6fbb7..dc3eaeeab61a794e92507a6c8304f03260e77679 100644 (file)
@@ -881,7 +881,34 @@ wild (s, section, file, target, output)
   else
     {
       /* Perform the iteration over a single file */
-      wild_section (s, section, lookup_name (file), output);
+      f = lookup_name (file);
+      if (f->the_bfd == NULL
+         || ! bfd_check_format (f->the_bfd, bfd_archive))
+       wild_section (s, section, f, output);
+      else
+       {
+         bfd *member;
+
+         /* This is an archive file.  We must map each member of the
+             archive separately.  */
+         member = bfd_openr_next_archived_file (f->the_bfd, (bfd *) NULL);
+         while (member != NULL)
+           {
+             /* When lookup_name is called, it will call the
+                 add_symbols entry point for the archive.  For each
+                 element of the archive which is included, BFD will
+                 call ldlang_add_file, which will set the usrdata
+                 field of the member to the lang_input_statement.  */
+             if (member->usrdata != NULL)
+               {
+                 wild_section (s, section,
+                               (lang_input_statement_type *) member->usrdata,
+                               output);
+               }
+
+             member = bfd_openr_next_archived_file (f->the_bfd, member);
+           }
+       }
     }
   if (section != (char *) NULL
       && strcmp (section, "COMMON") == 0