[PATCH][SH] SH CFI directives patch, revised

Thomas Schwinge thomas@codesourcery.com
Sat Jun 23 10:21:00 GMT 2012


Hi!

On Mon, 28 May 2012 00:26:46 +0200, I wrote:
> On Thu, 17 May 2012 18:33:08 +0800, Chung-Lin Tang <cltang@codesourcery.com> wrote:
> diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
> index e3aaeee..7a192a9 100644
> --- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
> +++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
> @@ -263,6 +263,7 @@ __lll_robust_timedlock_wait:
>  	cfi_restore (r8)
>  	cfi_restore (r9)
>  	cfi_restore (r10)
> +	cfi_restore (r11)
>  	cfi_def_cfa_offset (0)
>  	rts
>  	 mov	#EINVAL, r0
> 
> Should be obvious.
> 
> But, in this case, wouldn't it be simpler to use a nested
> ».cfi_remember_state [...] .cfi_remember_state [...] .cfi_restore_state
> [...]  .cfi_restore_state« instead of restoring the state manually (as
> quoted)?  My reading of GDB's dwarf2-frame seems to confirm that this is
> permissible.  (No need to send a patch if you agree.

I pushed the following as commit
4b2c8da708024ca9f7a6f86bdb46cb8c0d6df275:

2012-06-23  Thomas Schwinge  <thomas@codesourcery.com>

	* sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
	(__lll_robust_timedlock_wait): Simplify CFI directives.

diff --git a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
index 7a192a9..d2624dd 100644
--- a/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
+++ b/nptl/sysdeps/unix/sysv/linux/sh/lowlevelrobustlock.S
@@ -139,6 +139,8 @@ __lll_robust_timedlock_wait:
 	cmp/hs	r0, r1
 	bt	3f
 
+	cfi_remember_state
+
 	mov.l	r11, @-r15
 	cfi_adjust_cfa_offset(4)
 	cfi_rel_offset (r11, 0)
@@ -258,13 +260,9 @@ __lll_robust_timedlock_wait:
 8:
 	bra	6b
 	 mov	#ETIMEDOUT, r0
+
+	cfi_restore_state
 3:
-	/* Restore initial state for invalid timeout case.  */
-	cfi_restore (r8)
-	cfi_restore (r9)
-	cfi_restore (r10)
-	cfi_restore (r11)
-	cfi_def_cfa_offset (0)
 	rts
 	 mov	#EINVAL, r0
 	cfi_endproc


> I'd also prepare a
> patch to improve the binutils documentation.)

Still to be done.


Grüße,
 Thomas
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 489 bytes
Desc: not available
URL: <http://sourceware.org/pipermail/libc-alpha/attachments/20120623/f118fa65/attachment.sig>


More information about the Libc-alpha mailing list