* elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount.
authorBob Wilson <bob.wilson@acm.org>
Thu, 18 Sep 2008 00:37:47 +0000 (00:37 +0000)
committerBob Wilson <bob.wilson@acm.org>
Thu, 18 Sep 2008 00:37:47 +0000 (00:37 +0000)
bfd/ChangeLog
bfd/elf32-xtensa.c

index 97c46de..4a1769d 100644 (file)
@@ -1,3 +1,7 @@
+2008-09-17  Bob Wilson  <bob.wilson@acm.org>
+
+       * elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount.
+
 2008-09-17  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
        PR 6893 - Do not consider FDEs for discarded sections as invalid.
index 3463efa..dadf42b 100644 (file)
@@ -1087,8 +1087,13 @@ elf_xtensa_check_relocs (bfd *abfd,
        {
          if (is_plt)
            {
-             h->plt.refcount += 1;
-             h->needs_plt = 1;
+             if (h->plt.refcount <= 0)
+               {
+                 h->needs_plt = 1;
+                 h->plt.refcount = 1;
+               }
+             else
+               h->plt.refcount += 1;
 
              /* Keep track of the total PLT relocation count even if we
                 don't yet know whether the dynamic sections will be
@@ -1102,7 +1107,12 @@ elf_xtensa_check_relocs (bfd *abfd,
                }
            }
          else if (is_got)
-           h->got.refcount += 1;
+           {
+             if (h->got.refcount <= 0)
+               h->got.refcount = 1;
+             else
+               h->got.refcount += 1;
+           }
 
          if (is_tlsfunc)
            eh->tlsfunc_refcount += 1;