[PATCH] Simplify mips16 conversion to even address

Fred Fish fnf@ninemoons.com
Fri Mar 5 04:54:00 GMT 2004


While looking at something else I noticed some code that first checks
and address to see if it is even or odd, before forcing it to even.
That seems sort of pointless, why bother testing it, unless perhaps
I'm missing something.  Here's an admittedly untested patch.

2004-03-04  Fred Fish  <fnf@redhat.com>

	* elfxx-mips.c (_bfd_mips_elf_finish_dynamic_symbol): Just force
	mips16 symbols to be even rather than testing first for even/odd.

Index: elfxx-mips.c
===================================================================
RCS file: /cvs/src/src/bfd/elfxx-mips.c,v
retrieving revision 1.90
diff -u -p -r1.90 elfxx-mips.c
--- elfxx-mips.c	17 Feb 2004 10:19:23 -0000	1.90
+++ elfxx-mips.c	5 Mar 2004 04:53:19 -0000
@@ -1,6 +1,6 @@
 /* MIPS-specific support for ELF
    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-   2003 Free Software Foundation, Inc.
+   2003, 2004 Free Software Foundation, Inc.
 
    Most of the information added by Ian Lance Taylor, Cygnus Support,
    <ian@cygnus.com>.
@@ -6814,9 +6814,8 @@ _bfd_mips_elf_finish_dynamic_symbol (bfd
     }
 
   /* If this is a mips16 symbol, force the value to be even.  */
-  if (sym->st_other == STO_MIPS16
-      && (sym->st_value & 1) != 0)
-    --sym->st_value;
+  if (sym->st_other == STO_MIPS16)
+    sym->st_value &= ~1;
 
   return TRUE;
 }




More information about the Binutils mailing list