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

Douglas B Rupp rupp@gnat.com
Fri Mar 8 03:15:00 GMT 2013


Please find attached my revised patch with a new testcase, and a fix to 
a regressing testcase.

--Doug

On 03/06/2013 03:00 PM, Jim Wilson wrote:
> The patch looks OK to me.
>
> A small testcase for the gas testsuite might be useful to ensure that
> the slot number remains 1.
>
> Jim
>

-------------- next part --------------
Index: gas/ChangeLog
===================================================================
RCS file: /cvs/src/src/gas/ChangeLog,v
retrieving revision 1.4933
diff -u -p -r1.4933 ChangeLog
--- gas/ChangeLog	19 Feb 2013 19:10:22 -0000	1.4933
+++ gas/ChangeLog	8 Mar 2013 02:57:51 -0000
@@ -1,3 +1,11 @@
+2013-02-21  Douglas B Rupp  <rupp@gnat.com>
+
+	* config/tc-ia64.c (emit_one_bundle): Move last_slot adjustment
+	after fixup.
+	* testsuite/gas/ia64/ia64.exp: Add new test reloc-mlx
+	* testsuite/gas/ia64/reloc-mlx.[sd]: New test for X-unit reloc.
+	* testsuite/gas/ia64/pcrel.d: Fix output for X-unit reloc.
+
 2013-02-19  H.J. Lu  <hongjiu.lu@intel.com>
 
 	PR gas/15159
Index: gas/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
--- gas/config/tc-ia64.c	4 Sep 2012 13:52:06 -0000	1.220
+++ gas/config/tc-ia64.c	8 Mar 2013 02:58:13 -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]));
Index: gas/testsuite/gas/ia64/ia64.exp
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ia64/ia64.exp,v
retrieving revision 1.46
diff -u -p -r1.46 ia64.exp
--- gas/testsuite/gas/ia64/ia64.exp	17 Dec 2012 16:55:53 -0000	1.46
+++ gas/testsuite/gas/ia64/ia64.exp	8 Mar 2013 02:58:25 -0000
@@ -65,6 +65,7 @@ if [istarget "ia64-*"] then {
     run_dump_test "dependency-1"
 
     run_dump_test "reloc"
+    run_dump_test "reloc-mlx"
     run_list_test "reloc-bad" ""
     run_dump_test "pcrel"
 
Index: gas/testsuite/gas/ia64/pcrel.d
===================================================================
RCS file: /cvs/src/src/gas/testsuite/gas/ia64/pcrel.d,v
retrieving revision 1.4
diff -u -p -r1.4 pcrel.d
--- gas/testsuite/gas/ia64/pcrel.d	14 May 2012 02:40:00 -0000	1.4
+++ gas/testsuite/gas/ia64/pcrel.d	8 Mar 2013 02:58:25 -0000
@@ -13,10 +13,10 @@ OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[
 
 RELOCATION RECORDS FOR \[\.movl\]:
 OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
-0+12[[:space:]]+PCREL64I[[:space:]]+esym
-0+22[[:space:]]+PCREL64I[[:space:]]+esym\+0x0+20
-0+32[[:space:]]+PCREL64I[[:space:]]+esym
-0+42[[:space:]]+PCREL64I[[:space:]]+esym-0x0+20
+0+11[[:space:]]+PCREL64I[[:space:]]+esym
+0+21[[:space:]]+PCREL64I[[:space:]]+esym\+0x0+20
+0+31[[:space:]]+PCREL64I[[:space:]]+esym
+0+41[[:space:]]+PCREL64I[[:space:]]+esym-0x0+20
 
 RELOCATION RECORDS FOR \[\.data8\]:
 OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
--- /dev/null	2013-02-23 22:20:33.700325006 -0800
+++ gas/testsuite/gas/ia64/reloc-mlx.s	2013-03-07 18:48:13.669027930 -0800
@@ -0,0 +1,7 @@
+        .text
+        .proc foo#
+foo:
+        .mlx
+        mov r25 = r0
+        brl.call.sptk.many b0 = bar#
+        .endp foo#
--- /dev/null	2013-02-23 22:20:33.700325006 -0800
+++ gas/testsuite/gas/ia64/reloc-mlx.d	2013-03-07 19:02:06.209040422 -0800
@@ -0,0 +1,8 @@
+#objdump: -r
+#name: ia64 mlx reloc
+
+.*: +file format .*
+
+RELOCATION RECORDS FOR \[\.text\]:
+OFFSET[[:space:]]+TYPE[[:space:]]+VALUE[[:space:]]*
+0+1[[:space:]]+PCREL60B[[:space:]]+bar


More information about the Binutils mailing list