* linker.c (_bfd_generic_link_output_symbols,
authorIan Lance Taylor <ian@airs.com>
Thu, 3 Feb 1994 23:01:49 +0000 (23:01 +0000)
committerIan Lance Taylor <ian@airs.com>
Thu, 3 Feb 1994 23:01:49 +0000 (23:01 +0000)
_bfd_generic_link_write_global_symbol): Don't require that all
references to a common symbol be themselves common symbols.

bfd/ChangeLog
bfd/linker.c

index bdab6ae87a0a129539462636e572e946c0d34bd2..63c37380021d86d41bb197e3cc0c47ae712bbd2f 100644 (file)
@@ -1,5 +1,9 @@
 Thu Feb  3 16:49:35 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
+       * linker.c (_bfd_generic_link_output_symbols,
+       _bfd_generic_link_write_global_symbol): Don't require that all
+       references to a common symbol be themselves common symbols.
+
        * aoutx.h (aout_reloc_index_to_section): Handle N_UNDF.
 
 Wed Feb  2 20:37:19 1994  Jim Kingdon  (kingdon@lioth.cygnus.com)
index f70f799437509e346cf59a5b44f7a04c18dadaba..0803c7db807a5cef1824a832958f764deefdfb00 100644 (file)
@@ -1656,13 +1656,17 @@ _bfd_generic_link_output_symbols (output_bfd, input_bfd, info, psymalloc)
                case bfd_link_hash_common:
                  sym->value = h->root.u.c.size;
                  sym->flags |= BSF_GLOBAL;
+                 if (! bfd_is_com_section (sym->section))
+                   {
+                     BFD_ASSERT (sym->section == &bfd_und_section);
+                     sym->section = &bfd_com_section;
+                   }
                  /* We do not set the section of the symbol to
-                    c.section.  c.section is saved so that we know
-                    where to allocate the symbol if we define it.  In
-                    this case the type is still bfd_link_hash_common,
-                    so we did not define it, so we do not want to use
-                    that section.  */
-                 BFD_ASSERT (bfd_is_com_section (sym->section));
+                    h->root.u.c.section.  That value was saved so
+                    that we would know where to allocate the symbol
+                    if it was defined.  In this case the type is
+                    still bfd_link_hash_common, so we did not define
+                    it, so we do not want to use that section.  */
                  break;
                }
            }
@@ -1794,8 +1798,12 @@ _bfd_generic_link_write_global_symbol (h, data)
       break;
     case bfd_link_hash_common:
       sym->value = h->root.u.c.size;
+      if (! bfd_is_com_section (sym->section))
+       {
+         BFD_ASSERT (sym->section == &bfd_und_section);
+         sym->section = &bfd_com_section;
+       }
       /* Do not set the section; see _bfd_generic_link_output_symbols.  */
-      BFD_ASSERT (bfd_is_com_section (sym->section));
       break;
     case bfd_link_hash_indirect:
     case bfd_link_hash_warning: