This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Xtensa] fix regression in TLS patch


My TLS patch from 2008-08-20 inadvertently removed a check for symbol refcounts less than zero. I forget why that is needed, but it was working fine that way before, so I've restored the old code. I've committed it on the trunk and I'm going to put it on the branch, too.

bfd/ChangeLog
2008-09-17  Bob Wilson  <bob.wilson@acm.org>

* elf32-xtensa.c (elf_xtensa_check_relocs): Check for negative refcount.
Index: elf32-xtensa.c
===================================================================
RCS file: /cvs/src/src/bfd/elf32-xtensa.c,v
retrieving revision 1.111
diff -u -p -r1.111 elf32-xtensa.c
--- elf32-xtensa.c	20 Aug 2008 23:28:58 -0000	1.111
+++ elf32-xtensa.c	18 Sep 2008 00:34:53 -0000
@@ -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;

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]