| 1 | See http://sourceware.org/bugzilla/show_bug.cgi?id=13990 for details. |
| 2 | --- |
| 3 | diff -u -r1.287 -r1.288 |
| 4 | --- a/bfd/elf32-arm.c 2012/04/24 05:12:31 1.287 |
| 5 | +++ b/bfd/elf32-arm.c 2012/04/24 16:09:12 1.288 |
| 6 | @@ -12256,8 +12256,19 @@ |
| 7 | if (may_need_local_target_p |
| 8 | && elf32_arm_get_plt_info (abfd, eh, r_symndx, &root_plt, &arm_plt)) |
| 9 | { |
| 10 | - BFD_ASSERT (root_plt->refcount > 0); |
| 11 | - root_plt->refcount -= 1; |
| 12 | + /* If PLT refcount book-keeping is wrong and too low, we'll |
| 13 | + see a zero value (going to -1) for the root PLT reference |
| 14 | + count. */ |
| 15 | + if (root_plt->refcount >= 0) |
| 16 | + { |
| 17 | + BFD_ASSERT (root_plt->refcount != 0); |
| 18 | + root_plt->refcount -= 1; |
| 19 | + } |
| 20 | + else |
| 21 | + /* A value of -1 means the symbol has become local, forced |
| 22 | + or seeing a hidden definition. Any other negative value |
| 23 | + is an error. */ |
| 24 | + BFD_ASSERT (root_plt->refcount == -1); |
| 25 | |
| 26 | if (!call_reloc_p) |
| 27 | arm_plt->noncall_refcount--; |
| 28 | |
| 29 | |