[PATCH,IA64] Fix bug in double slot instruction reloc

Douglas B Rupp rupp@gnat.com
Thu Feb 21 21:15:00 GMT 2013


Please find attached my proposed fix to a bug which shows up on ia64 vms 
with the "brl" instruction. It needs both approval and commit.

It has been tested on ia64-vms and ia64-hpux.

I would welcome write after approval privs, when deemed appropriate, for 
binutils as I have more patches for Windows, VMS, and a new architecture 
to submit for approval.

--Douglas Rupp, Sr. Software Engineer
AdaCore



-------------- next part --------------
Index: ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.4933
diff -u -p -r1.4933 ChangeLog
--- ChangeLog	19 Feb 2013 19:10:22 -0000	1.4933
+++ ChangeLog	21 Feb 2013 21:05:21 -0000
@@ -1,3 +1,8 @@
+2013-02-21  Douglas B Rupp  <rupp@gnat.com>
+
+	* config/tc-ia64.c (emit_one_bundle): Move last_slot adjustment
+	after fixup.
+
 2013-02-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR gas/15159
Index: config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.220
diff -u -p -r1.220 tc-ia64.c
--- config/tc-ia64.c	4 Sep 2012 13:52:06 -0000	1.220
+++ config/tc-ia64.c	21 Feb 2013 21:05:42 -0000
@@ -1,6 +1,6 @@
 /* tc-ia64.c -- Assembler for the HP/Intel IA-64 architecture.
    Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
-   2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+   2008, 2009, 2011, 2012, 2013 Free Software Foundation, Inc.
    Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
 
    This file is part of GAS, the GNU Assembler.
@@ -6934,15 +6934,6 @@ emit_one_bundle (void)
 	  md.slot[curr].unwind_record = NULL;
 	}
 
-      if (required_unit == IA64_UNIT_L)
-	{
-	  know (i == 1);
-	  /* skip one slot for long/X-unit instructions */
-	  ++i;
-	}
-      --md.num_slots_in_use;
-      last_slot = i;
-
       for (j = 0; j < md.slot[curr].num_fixups; ++j)
 	{
 	  ifix = md.slot[curr].fixup + j;
@@ -6955,6 +6946,17 @@ emit_one_bundle (void)
 
       end_of_insn_group = md.slot[curr].end_of_insn_group;
 
+      /* This adjustment to "i" must occur after the fix, otherwise the fix
+	 is assigned to the wrong slot, and the VMS linker complains.  */
+      if (required_unit == IA64_UNIT_L)
+	{
+	  know (i == 1);
+	  /* skip one slot for long/X-unit instructions */
+	  ++i;
+	}
+      --md.num_slots_in_use;
+      last_slot = i;
+
       /* clear slot:  */
       ia64_free_opcode (md.slot[curr].idesc);
       memset (md.slot + curr, 0, sizeof (md.slot[curr]));


More information about the Binutils mailing list