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]

mn10300's btst, bclr and bset broken


This patch:

2001-04-14  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-mn10300.c (md_assemble): Simplify offset adjustment of
	pc-relative relocations not placed at the end of the instruction.

broke btst, bclr and bset, because the offset of the address into the
instruction wasn't taken into account when computing the relocation
address.  This patch fixes it.  I'm checking it in, approved by Eric
Christopher:

Index: gas/ChangeLog
from  Alexandre Oliva  <aoliva@redhat.com>

	* config/tc-mn10300.c (md_assemble): Subtract operand->shift
	from offset in non-pcrel operands too.

Index: gas/config/tc-mn10300.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-mn10300.c,v
retrieving revision 1.21
diff -u -p -r1.21 tc-mn10300.c
--- gas/config/tc-mn10300.c 2001/04/14 06:53:57 1.21
+++ gas/config/tc-mn10300.c 2001/05/06 20:00:38
@@ -1727,13 +1727,7 @@ keep_going:
 	      /* Is the reloc pc-relative?  */
 	      pcrel = (operand->flags & MN10300_OPERAND_PCREL) != 0;
 
-	      offset = size - reloc_size / 8;
-
-	      /* If the pcrel relocation isn't at the end of the insn,
-		 we have to adjust the offset for the relocation to be
-		 correct.  */
-	      if (pcrel)
-		offset -= operand->shift / 8;
+	      offset = size - (reloc_size + operand->shift) / 8;
 
 	      /* Choose a proper BFD relocation type.  */
 	      if (pcrel)

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

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