From d68e16ffa1a0a3c9f49ef1dec3c2973abaf9eadc Mon Sep 17 00:00:00 2001 From: Bob Wilson Date: Thu, 18 Sep 2008 00:48:59 +0000 Subject: [PATCH] * elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount. --- bfd/ChangeLog | 4 ++++ bfd/elf32-xtensa.c | 16 +++++++++++++--- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index a79d40ee5ad..7fe59520d47 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,7 @@ +2008-09-17 Bob Wilson + + * elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount. + 2008-09-17 Tristan Gingold * configure.in: Bump version to 2.18.91 diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c index 3463efa8c34..dadf42bc42b 100644 --- a/bfd/elf32-xtensa.c +++ b/bfd/elf32-xtensa.c @@ -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; -- 2.47.3