2002-05-21 H.J. Lu (hjl@gnu.org)
authorH.J. Lu <hjl.tools@gmail.com>
Wed, 22 May 2002 05:06:18 +0000 (05:06 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Wed, 22 May 2002 05:06:18 +0000 (05:06 +0000)
* linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
definition.

bfd/ChangeLog
bfd/linker.c

index 9470bc53cc168f8f89fde77882a7184db7d640e7..25af58b0793be0a14423fb06fd0f8fa07d94b988 100644 (file)
@@ -1,3 +1,8 @@
+2002-05-21  H.J. Lu  (hjl@gnu.org)
+
+       * linker.c (_bfd_generic_link_add_one_symbol): Allow multiple
+       definition.
+
 2002-05-22  Alan Modra  <amodra@bigpond.net.au>
 
        * elf64-ppc.c (ppc64_elf_size_stubs): Don't strip .branch_lt.
index 8d2287239ad80b6c079d7f633ad360e9235585d9..228f088a0175de28aa3689b5714987e48c1bb8d7 100644 (file)
@@ -1813,37 +1813,38 @@ _bfd_generic_link_add_one_symbol (info, abfd, name, flags, section, value,
          /* Fall through.  */
        case MDEF:
          /* Handle a multiple definition.  */
-         {
-           asection *msec = NULL;
-           bfd_vma mval = 0;
+         if (!info->allow_multiple_definition)
+           {
+             asection *msec = NULL;
+             bfd_vma mval = 0;
 
-           switch (h->type)
-             {
-             case bfd_link_hash_defined:
-               msec = h->u.def.section;
-               mval = h->u.def.value;
-               break;
-             case bfd_link_hash_indirect:
-               msec = bfd_ind_section_ptr;
-               mval = 0;
-               break;
-             default:
-               abort ();
-             }
+             switch (h->type)
+               {
+               case bfd_link_hash_defined:
+                 msec = h->u.def.section;
+                 mval = h->u.def.value;
+                 break;
+               case bfd_link_hash_indirect:
+                 msec = bfd_ind_section_ptr;
+                 mval = 0;
+                 break;
+               default:
+                 abort ();
+               }
 
-           /* Ignore a redefinition of an absolute symbol to the same
-               value; it's harmless.  */
-           if (h->type == bfd_link_hash_defined
-               && bfd_is_abs_section (msec)
-               && bfd_is_abs_section (section)
-               && value == mval)
-             break;
+             /* Ignore a redefinition of an absolute symbol to the
+                same value; it's harmless.  */
+             if (h->type == bfd_link_hash_defined
+                 && bfd_is_abs_section (msec)
+                 && bfd_is_abs_section (section)
+                 && value == mval)
+               break;
 
-           if (! ((*info->callbacks->multiple_definition)
-                  (info, h->root.string, msec->owner, msec, mval, abfd,
-                   section, value)))
-             return false;
-         }
+             if (! ((*info->callbacks->multiple_definition)
+                    (info, h->root.string, msec->owner, msec, mval,
+                     abfd, section, value)))
+               return false;
+           }
          break;
 
        case CIND: