This is the mail archive of the binutils@sources.redhat.com 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]

Re: Improvements and fixes for mips n32/n64 relocations


On Apr 11, 2003, Alexandre Oliva <aoliva at redhat dot com> wrote:

> On Apr 10, 2003, Eric Christopher <echristo at redhat dot com> wrote:
>> Yes with the change I noticed offline and the one that I missed that cgd
>> spotted and the changes you noticed :)

> Here's one more problem introduced along with my patch.  I'm going
> ahead and checking it in, since you approved it in private.

Of course, the two other occurrences of the same test had to be
adjusted as well, which unfortunately was only noticeable at run-time.
While at that, I thought I'd avoid keeping three separate copies of
the same test all over, and unified them into a single location.
Since Eric had agreed with the patch in principle, I'm going ahead and
checking this in.  Please let me know if you'd like any tweaks or
further changes to it.

Index: bfd/ChangeLog
from  Alexandre Oliva  <aoliva at redhat dot com>

	* elfxx-mips.c (mips_elf_calculate_relocation): Adjust two other
	occurrences of the same test changed in the previous patch.
	Optimize.

Index: bfd/elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.50
diff -u -p -r1.50 elfxx-mips.c
--- bfd/elfxx-mips.c 12 Apr 2003 00:31:42 -0000 1.50
+++ bfd/elfxx-mips.c 12 Apr 2003 08:45:52 -0000
@@ -3221,12 +3221,14 @@ mips_elf_calculate_relocation (abfd, inp
   switch (r_type)
     {
     case R_MIPS_GOT_PAGE:
+    case R_MIPS_GOT_OFST:
       /* If this symbol got a global GOT entry, we have to decay
 	 GOT_PAGE/GOT_OFST to GOT_DISP/addend.  */
-      if (local_p || ! h
-	  || (h->root.dynindx
-	      < mips_elf_get_global_gotsym_index (elf_hash_table (info)
-						  ->dynobj)))
+      local_p = local_p || ! h
+	|| (h->root.dynindx
+	    < mips_elf_get_global_gotsym_index (elf_hash_table (info)
+						->dynobj));
+      if (local_p || r_type == R_MIPS_GOT_OFST)
 	break;
       /* Fall through.  */
 
@@ -3512,7 +3514,7 @@ mips_elf_calculate_relocation (abfd, inp
       /* GOT_PAGE relocations that reference non-local symbols decay
 	 to GOT_DISP.  The corresponding GOT_OFST relocation decays to
 	 0.  */
-      if (! (local_p || ! h || h->root.dynindx < 0))
+      if (! local_p)
 	goto got_disp;
       value = mips_elf_got_page (abfd, input_bfd, info, symbol + addend, NULL);
       if (value == MINUS_ONE)
@@ -3523,7 +3525,7 @@ mips_elf_calculate_relocation (abfd, inp
       break;
 
     case R_MIPS_GOT_OFST:
-      if (local_p || ! h || h->root.dynindx < 0)
+      if (local_p)
 	mips_elf_got_page (abfd, input_bfd, info, symbol + addend, &value);
       else
 	value = addend;
-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                 aoliva at {redhat dot com, gcc.gnu.org}
CS PhD student at IC-Unicamp        oliva at {lsd dot ic dot unicamp dot br, gnu.org}
Free Software Evangelist                Professional serial bug killer

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