* cofflink.c (_bfd_coff_link_input_bfd): Don't try to optimize a
authorIan Lance Taylor <ian@airs.com>
Mon, 26 Feb 1996 19:01:53 +0000 (19:01 +0000)
committerIan Lance Taylor <ian@airs.com>
Mon, 26 Feb 1996 19:01:53 +0000 (19:01 +0000)
struct/union/enum type with no elements.
PR 9024.

bfd/ChangeLog
bfd/cofflink.c

index bdd3ef0fdcf6cd13d5abcd3fa2ec451dcc78ca21..98acdfb3fb81005d625f47aa26cb2f9e83c9fbf4 100644 (file)
@@ -1,3 +1,8 @@
+Mon Feb 26 14:01:13 1996  Ian Lance Taylor  <ian@cygnus.com>
+
+       * cofflink.c (_bfd_coff_link_input_bfd): Don't try to optimize a
+       struct/union/enum type with no elements.
+
 Sat Feb 24 11:38:58 1996  Ian Lance Taylor  <ian@cygnus.com>
 
        * bfd.c (bfd_errmsg): Handle a NULL return from strerror.
 Sat Feb 24 11:38:58 1996  Ian Lance Taylor  <ian@cygnus.com>
 
        * bfd.c (bfd_errmsg): Handle a NULL return from strerror.
index 999a81e1bbb87043e5ca496802701ab2fc8f4f43..92b19e21b962dd34c071e7abd05a28840c7692a2 100644 (file)
@@ -1,5 +1,5 @@
 /* COFF specific linker code.
 /* COFF specific linker code.
-   Copyright 1994, 1995 Free Software Foundation, Inc.
+   Copyright 1994, 1995, 1996 Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
    Written by Ian Lance Taylor, Cygnus Support.
 
 This file is part of BFD, the Binary File Descriptor library.
@@ -365,7 +365,7 @@ coff_link_add_symbols (abfd, info)
              value -= section->vma;
            }
 
              value -= section->vma;
            }
 
-         if (! (_bfd_generic_link_add_one_symbol
+         if (! (bfd_coff_link_add_one_symbol
                 (info, abfd, name, flags, section, value,
                  (const char *) NULL, copy, false,
                  (struct bfd_link_hash_entry **) sym_hash)))
                 (info, abfd, name, flags, section, value,
                  (const char *) NULL, copy, false,
                  (struct bfd_link_hash_entry **) sym_hash)))
@@ -1189,7 +1189,6 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
          struct coff_debug_merge_element **epp;
          bfd_byte *esl, *eslend;
          struct internal_syment *islp;
          struct coff_debug_merge_element **epp;
          bfd_byte *esl, *eslend;
          struct internal_syment *islp;
-         struct coff_debug_merge_type *mtl;
 
          name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
          if (name == NULL)
 
          name = _bfd_coff_internal_syment_name (input_bfd, &isym, buf);
          if (name == NULL)
@@ -1293,42 +1292,50 @@ _bfd_coff_link_input_bfd (finfo, input_bfd)
            }
 
          /* See if we already have a definition which matches this
            }
 
          /* See if we already have a definition which matches this
-             type.  */
-         for (mtl = mh->types; mtl != NULL; mtl = mtl->next)
+             type.  We always output the type if it has no elements,
+             for simplicity.  */
+         if (mt->elements == NULL)
+           bfd_release (input_bfd, (PTR) mt);
+         else
            {
            {
-             struct coff_debug_merge_element *me, *mel;
-
-             if (mtl->class != mt->class)
-               continue;
+             struct coff_debug_merge_type *mtl;
 
 
-             for (me = mt->elements, mel = mtl->elements;
-                  me != NULL && mel != NULL;
-                  me = me->next, mel = mel->next)
+             for (mtl = mh->types; mtl != NULL; mtl = mtl->next)
                {
                {
-                 if (strcmp (me->name, mel->name) != 0
-                     || me->type != mel->type
-                     || me->tagndx != mel->tagndx)
+                 struct coff_debug_merge_element *me, *mel;
+
+                 if (mtl->class != mt->class)
+                   continue;
+
+                 for (me = mt->elements, mel = mtl->elements;
+                      me != NULL && mel != NULL;
+                      me = me->next, mel = mel->next)
+                   {
+                     if (strcmp (me->name, mel->name) != 0
+                         || me->type != mel->type
+                         || me->tagndx != mel->tagndx)
+                       break;
+                   }
+
+                 if (me == NULL && mel == NULL)
                    break;
                }
 
                    break;
                }
 
-             if (me == NULL && mel == NULL)
-               break;
-           }
-
-         if (mtl == NULL || (bfd_size_type) mtl->indx >= syment_base)
-           {
-             /* This is the first definition of this type.  */
-             mt->indx = output_index;
-             mt->next = mh->types;
-             mh->types = mt;
-           }
-         else
-           {
-             /* This is a redefinition which can be merged.  */
-             bfd_release (input_bfd, (PTR) mt);
-             *indexp = mtl->indx;
-             add = (eslend - esym) / isymesz;
-             skip = true;
+             if (mtl == NULL || (bfd_size_type) mtl->indx >= syment_base)
+               {
+                 /* This is the first definition of this type.  */
+                 mt->indx = output_index;
+                 mt->next = mh->types;
+                 mh->types = mt;
+               }
+             else
+               {
+                 /* This is a redefinition which can be merged.  */
+                 bfd_release (input_bfd, (PTR) mt);
+                 *indexp = mtl->indx;
+                 add = (eslend - esym) / isymesz;
+                 skip = true;
+               }
            }
        }
 
            }
        }
 
This page took 0.046928 seconds and 4 git commands to generate.