[PATCH] MIPS/BFD: Keep the addend in microMIPS JAL->JALS relaxation

Maciej W. Rozycki macro@codesourcery.com
Mon Oct 24 23:55:00 GMT 2011


Hi,

 JAL's addend may be unlikely, but that does not mean it makes sense to 
discard it in the microMIPS JAL->JALS relaxation.  Let's keep it then.

 Regression-tested successfully, for the mips-linux-gnu and mips-sde-elf 
targets.  OK to apply?

2011-10-25  Maciej W. Rozycki  <macro@codesourcery.com>

	bfd/
	* elfxx-mips.c (_bfd_mips_elf_relax_section): Keep JAL's addend
	in JALS relaxation.

  Maciej

binutils-umips-relax-jals-fix.diff
Index: binutils-fsf-trunk-quilt/bfd/elfxx-mips.c
===================================================================
--- binutils-fsf-trunk-quilt.orig/bfd/elfxx-mips.c	2011-10-24 23:03:23.755860656 +0100
+++ binutils-fsf-trunk-quilt/bfd/elfxx-mips.c	2011-10-24 23:03:23.855901116 +0100
@@ -12915,7 +12915,10 @@ _bfd_mips_elf_relax_section (bfd *abfd, 
 	    {
 	      /* JAL with 32-bit delay slot that is changed to a JALS
 	         with 16-bit delay slot.  */
-	      bfd_put_micromips_32 (abfd, jal_insn_32_bd16.match, ptr);
+	      opcode = bfd_get_micromips_32 (abfd, ptr);
+	      opcode &= ~jal_insn_32_bd32.mask;
+	      opcode |= jal_insn_32_bd16.match;
+	      bfd_put_micromips_32 (abfd, opcode, ptr);
 
 	      /* Delete 2 bytes from irel->r_offset + 6.  */
 	      delcnt = 2;



More information about the Binutils mailing list