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]
Other format: [Raw text]

small gas fix


Without this patch, the unwind-directive sequence:

	.restore sp
	.prologue

results in a epilogue directive with a "bad" (-1) "t" value of (u64)
-1, which wastes space and isn't really correct (though current
unwinder's don't seem to mind much).

The above sequence is needed, e.g., by GCC to handle sibcalls in
memory-stack-framless procedures.

For example, with broken gas:

<_Z17_Jv_NewMultiArrayPN4java4lang5ClassEiPi>: [0x2160-0x2240], info at +0x230
  v1, flags=0x0 (), len=24 bytes
    R2:prologue_gr(mask=[rp,ar.pfs],grsave=r36,rlen=6)
        P7:pfs_when(t=0)
        P7:rp_when(t=2)
    R1:body(rlen=15)
        B1:label_state(label=1)
        B2:epilogue(t=18446744073709551615,ecount=0)
    R1:prologue(rlen=3)
    R1:body(rlen=18)
        B1:copy_state(label=1)

with the patch below applied:

<_Z17_Jv_NewMultiArrayPN4java4lang5ClassEiPi>: [0x2160-0x2240], info at +0x230
  v1, flags=0x0 (), len=16 bytes
    R2:prologue_gr(mask=[rp,ar.pfs],grsave=r36,rlen=6)
        P7:pfs_when(t=0)
        P7:rp_when(t=2)
    R1:body(rlen=15)
        B1:label_state(label=1)
        B2:epilogue(t=0,ecount=0)
    R1:prologue(rlen=3)
    R1:body(rlen=18)
        B1:copy_state(label=1)

So we save 8 bytes of unwind info.

If there are no objections, please apply.

	--david

gas/ChangeLog

2004-10-22  David Mosberger-Tang  <davidm@hpl.hp.com>

	* config/tc-ia64.c (fixup_unw_records): Don't let the "t" value in
	an epilogue directive go negative.

Index: config/tc-ia64.c
===================================================================
RCS file: /cvs/src/src/gas/config/tc-ia64.c,v
retrieving revision 1.117
diff -u -r1.117 tc-ia64.c
--- config/tc-ia64.c	21 Sep 2004 21:39:27 -0000	1.117
+++ config/tc-ia64.c	22 Oct 2004 16:49:22 -0000
@@ -2747,7 +2747,13 @@
 	    break;
 	  }
 	case epilogue:
-	  ptr->r.record.b.t = rlen - 1 - t;
+	  if (t < rlen)
+	    ptr->r.record.b.t = rlen - 1 - t;
+	  else
+	    /* This happens when a memory-stack-less procedure uses a
+	       ".restore sp" directive at the end of a region to pop
+	       the frame state.  */
+	    ptr->r.record.b.t = 0;
 	  break;
 
 	case mem_stack_f:


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