PR ld/13990
authorHans-Peter Nilsson <hp@axis.com>
Tue, 24 Apr 2012 16:09:12 +0000 (16:09 +0000)
committerHans-Peter Nilsson <hp@axis.com>
Tue, 24 Apr 2012 16:09:12 +0000 (16:09 +0000)
* elf32-arm.c (elf32_arm_gc_sweep_hook): Handle a forced-local
symbol, where PLT refcount is set to -1.

bfd/ChangeLog
bfd/elf32-arm.c

index 26c7a6cd6878cdd0f0bbca4d7c2a1de5928e9771..b46eb9c4e3abfdf3b4918b1e96b9ce3bb49675df 100644 (file)
@@ -1,3 +1,9 @@
+2012-04-24  Hans-Peter Nilsson  <hp@axis.com>
+
+       PR ld/13990
+       * elf32-arm.c (elf32_arm_gc_sweep_hook): Handle a forced-local
+       symbol, where PLT refcount is set to -1.
+
 2012-04-24  Alan Modra  <amodra@gmail.com>
 
        PR ld/13991
index 629e1f21cf741e24664be0377a77b5f8125dbfc0..9560906daabe325cbf8bf7b89f4620de1575e4d6 100644 (file)
@@ -12256,8 +12256,19 @@ elf32_arm_gc_sweep_hook (bfd *                     abfd,
       if (may_need_local_target_p
          && elf32_arm_get_plt_info (abfd, eh, r_symndx, &root_plt, &arm_plt))
        {
-         BFD_ASSERT (root_plt->refcount > 0);
-         root_plt->refcount -= 1;
+         /* If PLT refcount book-keeping is wrong and too low, we'll
+            see a zero value (going to -1) for the root PLT reference
+            count.  */
+         if (root_plt->refcount >= 0)
+           {
+             BFD_ASSERT (root_plt->refcount != 0);
+             root_plt->refcount -= 1;
+           }
+         else
+           /* A value of -1 means the symbol has become local, forced
+              or seeing a hidden definition.  Any other negative value
+              is an error.  */
+           BFD_ASSERT (root_plt->refcount == -1);
 
          if (!call_reloc_p)
            arm_plt->noncall_refcount--;