Eliminate third argument from _JMPBUF_UNWINDS

Message ID 871tuqmfad.fsf@igel.home
State Changes Requested, archived
Headers

Commit Message

Andreas Schwab June 15, 2014, 2:13 p.m. UTC
  _JMPBUF_UNWINDS is currently only used by Hurd, and always passes a
function as third argument that matches what various jmpbuf-unwind.h
implementations already do via _jmpbuf_sp (or ignore it anyway).
Eliminate this parameter to simplify its interface, and always to the
demangling in the macro body.

Not tested.

Andreas.

	* hurd/sigunwind.c (demangle_ptr): Remove function.
	(_hurdsig_longjmp_from_handler): Don't pass demangle_ptr to
	_JMPBUF_UNWINDS.
	* sysdeps/mach/hurd/jmp-unwind.c (demangle_ptr): Remove function.
	(_longjmp_unwind): Don't pass demangle_ptr to _JMPBUF_UNWINDS.
	* sysdeps/aarch64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Remove third
	parameter.
	* sysdeps/ia64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/sparc/sparc64/jmpbuf-unwind.h (_JMPBUF_UNWINDS):
	Likewise.
	* sysdeps/alpha/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.  Use
	_jmpbuf_sp instead.
	* sysdeps/arm/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/hppa/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/i386/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/m68k/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/microblaze/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/mips/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/powerpc/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/s390/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/sh/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/sparc/sparc32/jmpbuf-unwind.h (_JMPBUF_UNWINDS):
	Likewise.
	* sysdeps/tile/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
	* sysdeps/x86_64/jmpbuf-unwind.h (_JMPBUF_UNWINDS): Likewise.
---
 hurd/sigunwind.c                      | 10 +---------
 sysdeps/aarch64/jmpbuf-unwind.h       |  4 ++--
 sysdeps/alpha/jmpbuf-unwind.h         |  4 ++--
 sysdeps/arm/jmpbuf-unwind.h           |  4 ++--
 sysdeps/hppa/jmpbuf-unwind.h          |  5 ++---
 sysdeps/i386/jmpbuf-unwind.h          |  4 ++--
 sysdeps/ia64/jmpbuf-unwind.h          |  4 ++--
 sysdeps/m68k/jmpbuf-unwind.h          |  4 ++--
 sysdeps/mach/hurd/jmp-unwind.c        | 13 ++-----------
 sysdeps/microblaze/jmpbuf-unwind.h    |  4 ++--
 sysdeps/mips/jmpbuf-unwind.h          |  4 ++--
 sysdeps/powerpc/jmpbuf-unwind.h       |  4 ++--
 sysdeps/s390/jmpbuf-unwind.h          |  4 ++--
 sysdeps/sh/jmpbuf-unwind.h            |  4 ++--
 sysdeps/sparc/sparc32/jmpbuf-unwind.h |  4 ++--
 sysdeps/sparc/sparc64/jmpbuf-unwind.h |  2 +-
 sysdeps/tile/jmpbuf-unwind.h          |  4 ++--
 sysdeps/x86_64/jmpbuf-unwind.h        |  4 ++--
 18 files changed, 34 insertions(+), 52 deletions(-)
  

Comments

Roland McGrath June 16, 2014, 10:21 p.m. UTC | #1
So here you've encoded in jmpbuf-unwind.h the knowledge of whether the
machine has implement PTR_DEMANGLE (and if so, how).  This all but ensures
that when a machine adds PTR_MANGLE/PTR_DEMANGLE support, or changes how it
does the mangling, that the corresponding update in jmpbuf-unwind.h will be
forgotten.  How is this better?
  
Andreas Schwab June 16, 2014, 11:08 p.m. UTC | #2
Roland McGrath <roland@hack.frob.com> writes:

> This all but ensures that when a machine adds PTR_MANGLE/PTR_DEMANGLE
> support, or changes how it does the mangling, that the corresponding
> update in jmpbuf-unwind.h will be forgotten.

That will not happen.

> How is this better?

It removes a layer violation and consolidates the jmpbuf handling into
the architecture header.  The caller must not have knowlege of the
jmpbuf internals.

Andreas.
  
Roland McGrath June 17, 2014, 11:47 p.m. UTC | #3
> Roland McGrath <roland@hack.frob.com> writes:
> 
> > This all but ensures that when a machine adds PTR_MANGLE/PTR_DEMANGLE
> > support, or changes how it does the mangling, that the corresponding
> > update in jmpbuf-unwind.h will be forgotten.
> 
> That will not happen.

Your assertion alone does not reassure me.  
What guarantees this will not happen?

> > How is this better?
> 
> It removes a layer violation and consolidates the jmpbuf handling into
> the architecture header.  The caller must not have knowlege of the
> jmpbuf internals.

In the current scheme the caller does not have knowledge of jmp_buf
internals.  It is required to supply a function that performs PTR_DEMANGLE.
That's all it knows.  _JMPBUF_UNWINDS has the knowledge of how that
function is useful in interpreting a jmp_buf.
  
Andreas Schwab June 18, 2014, 4:43 p.m. UTC | #4
Roland McGrath <roland@hack.frob.com> writes:

>> Roland McGrath <roland@hack.frob.com> writes:
>> 
>> > This all but ensures that when a machine adds PTR_MANGLE/PTR_DEMANGLE
>> > support, or changes how it does the mangling, that the corresponding
>> > update in jmpbuf-unwind.h will be forgotten.
>> 
>> That will not happen.
>
> Your assertion alone does not reassure me.  
> What guarantees this will not happen?

Because I obviously didn't change anything here.  If you think there is
something wrong then it's not my fault.

> In the current scheme the caller does not have knowledge of jmp_buf
> internals.  It is required to supply a function that performs PTR_DEMANGLE.
> That's all it knows.  _JMPBUF_UNWINDS has the knowledge of how that
> function is useful in interpreting a jmp_buf.

It is still a layering violation and bad code duplication.  The callers
are not suposed to know about the mangling.  Moreover, the macros is
useless without demangling.

Andreas.
  

Patch

diff --git a/hurd/sigunwind.c b/hurd/sigunwind.c
index 6121e92..4c44e93 100644
--- a/hurd/sigunwind.c
+++ b/hurd/sigunwind.c
@@ -70,19 +70,11 @@  _hurdsig_longjmp_from_handler (void *data, jmp_buf env, int val)
 
       struct hurd_userlink *link;
 
-      inline uintptr_t demangle_ptr (uintptr_t x)
-	{
-# ifdef PTR_DEMANGLE
-	  PTR_DEMANGLE (x);
-# endif
-	  return x;
-	}
-
       /* Continue _longjmp_unwind's job of running the unwind
 	 forms for frames being unwound, since we will not
 	 return to its loop like this one, which called us.  */
       for (link = ss->active_resources;
-	   link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr);
+	   link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link);
 	   link = link->thread.next)
 	if (_hurd_userlink_unlink (link))
 	  {
diff --git a/sysdeps/aarch64/jmpbuf-unwind.h b/sysdeps/aarch64/jmpbuf-unwind.h
index 39a5dc2..83f4b5e 100644
--- a/sysdeps/aarch64/jmpbuf-unwind.h
+++ b/sysdeps/aarch64/jmpbuf-unwind.h
@@ -23,8 +23,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((void *) (address) < (void *) demangle (jmpbuf[JB_SP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(jmpbuf, context, adj) \
   _JMPBUF_UNWINDS_ADJ (jmpbuf, (void *) _Unwind_GetCFA (context), adj)
diff --git a/sysdeps/alpha/jmpbuf-unwind.h b/sysdeps/alpha/jmpbuf-unwind.h
index 1303cbd..41d5fef 100644
--- a/sysdeps/alpha/jmpbuf-unwind.h
+++ b/sysdeps/alpha/jmpbuf-unwind.h
@@ -24,8 +24,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
-  ((void *)(_address) < (void *) _demangle ((_jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address) \
+  ((uintptr_t) (_address) < _jmpbuf_sp (_jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/arm/jmpbuf-unwind.h b/sysdeps/arm/jmpbuf-unwind.h
index 4dfba44..d426214 100644
--- a/sysdeps/arm/jmpbuf-unwind.h
+++ b/sysdeps/arm/jmpbuf-unwind.h
@@ -22,8 +22,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((void *) (address) < (void *) demangle (jmpbuf[__JMP_BUF_SP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/hppa/jmpbuf-unwind.h b/sysdeps/hppa/jmpbuf-unwind.h
index 2a6788d..0fecbd2 100644
--- a/sysdeps/hppa/jmpbuf-unwind.h
+++ b/sysdeps/hppa/jmpbuf-unwind.h
@@ -21,6 +21,5 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle)			\
-  ((void *) (_address) >						\
-   (void *) _demangle ((((unsigned long *) _jmpbuf)[JB_SP])))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address)				\
+  ((unsigned long) (_address) > ((unsigned long *) _jmpbuf)[JB_SP])
diff --git a/sysdeps/i386/jmpbuf-unwind.h b/sysdeps/i386/jmpbuf-unwind.h
index 81faab2..45a5f8b 100644
--- a/sysdeps/i386/jmpbuf-unwind.h
+++ b/sysdeps/i386/jmpbuf-unwind.h
@@ -24,8 +24,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/ia64/jmpbuf-unwind.h b/sysdeps/ia64/jmpbuf-unwind.h
index 40fd72c..160fe7a 100644
--- a/sysdeps/ia64/jmpbuf-unwind.h
+++ b/sysdeps/ia64/jmpbuf-unwind.h
@@ -22,8 +22,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame containing a local
    variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(_jmpbuf, _address, _demangle) \
-  ((void *) (_address) < (void *) (((long int *) _jmpbuf)[0]))
+#define _JMPBUF_UNWINDS(_jmpbuf, _address) \
+  ((void *) (_address) < (void *) ((long int *) _jmpbuf)[0])
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   ({ uintptr_t _cfa = (uintptr_t) _Unwind_GetCFA (_context) - (_adj);	\
diff --git a/sysdeps/m68k/jmpbuf-unwind.h b/sysdeps/m68k/jmpbuf-unwind.h
index c0c62bc..9db177c 100644
--- a/sysdeps/m68k/jmpbuf-unwind.h
+++ b/sysdeps/m68k/jmpbuf-unwind.h
@@ -22,8 +22,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
-  ((void *) (address) < (void *) demangle ((uintptr_t) (jmpbuf)->__sp))
+#define _JMPBUF_UNWINDS(jmpbuf, address)		\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c
index 4df4edb..a7bcb94 100644
--- a/sysdeps/mach/hurd/jmp-unwind.c
+++ b/sysdeps/mach/hurd/jmp-unwind.c
@@ -28,15 +28,6 @@ 
 #error "<jmpbuf-unwind.h> fails to define _JMPBUF_UNWINDS"
 #endif
 
-static inline uintptr_t
-demangle_ptr (uintptr_t x)
-{
-# ifdef PTR_DEMANGLE
-  PTR_DEMANGLE (x);
-# endif
-  return x;
-}
-
 /* This function is called by `longjmp' (with its arguments) to restore
    active resources to a sane state before the frames code using them are
    jumped out of.  */
@@ -55,7 +46,7 @@  _longjmp_unwind (jmp_buf env, int val)
 
   /* Remove local signal preemptors being unwound past.  */
   while (ss->preemptors &&
-	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors, demangle_ptr))
+	 _JMPBUF_UNWINDS (env[0].__jmpbuf, ss->preemptors))
     ss->preemptors = ss->preemptors->next;
 
   __spin_unlock (&ss->lock);
@@ -65,7 +56,7 @@  _longjmp_unwind (jmp_buf env, int val)
      in stack frames being unwound by this jump.  */
 
   for (link = ss->active_resources;
-       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link, demangle_ptr);
+       link && _JMPBUF_UNWINDS (env[0].__jmpbuf, link);
        link = link->thread.next)
     /* Remove this link from the resource's users list,
        since the frame using the resource is being unwound.
diff --git a/sysdeps/microblaze/jmpbuf-unwind.h b/sysdeps/microblaze/jmpbuf-unwind.h
index e17a085..82a13c0 100644
--- a/sysdeps/microblaze/jmpbuf-unwind.h
+++ b/sysdeps/microblaze/jmpbuf-unwind.h
@@ -23,8 +23,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
-  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+#define _JMPBUF_UNWINDS(jmpbuf, address)		\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/mips/jmpbuf-unwind.h b/sysdeps/mips/jmpbuf-unwind.h
index 3126820..a381de0 100644
--- a/sysdeps/mips/jmpbuf-unwind.h
+++ b/sysdeps/mips/jmpbuf-unwind.h
@@ -22,8 +22,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
-  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__sp))
+#define _JMPBUF_UNWINDS(jmpbuf, address)		\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj)		\
   _JMPBUF_UNWINDS_ADJ (_jmpbuf,						\
diff --git a/sysdeps/powerpc/jmpbuf-unwind.h b/sysdeps/powerpc/jmpbuf-unwind.h
index 70ad88d..cc596c3 100644
--- a/sysdeps/powerpc/jmpbuf-unwind.h
+++ b/sysdeps/powerpc/jmpbuf-unwind.h
@@ -24,8 +24,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
-  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_GPR1]))
+#define _JMPBUF_UNWINDS(jmpbuf, address)			\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/s390/jmpbuf-unwind.h b/sysdeps/s390/jmpbuf-unwind.h
index a025fff..0d55e28 100644
--- a/sysdeps/s390/jmpbuf-unwind.h
+++ b/sysdeps/s390/jmpbuf-unwind.h
@@ -26,8 +26,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
-  ((void *) (address) < (void *) demangle ((jmpbuf)->__gregs[__JB_GPR15]))
+#define _JMPBUF_UNWINDS(jmpbuf, address)			\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 
 /* On s390{,x}, CFA is always 96 (resp. 160) bytes above actual
diff --git a/sysdeps/sh/jmpbuf-unwind.h b/sysdeps/sh/jmpbuf-unwind.h
index 99adec3..abae802 100644
--- a/sysdeps/sh/jmpbuf-unwind.h
+++ b/sysdeps/sh/jmpbuf-unwind.h
@@ -23,8 +23,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)		\
-  ((void *) (address) < (void *) demangle ((jmpbuf)[0].__regs[7]))
+#define _JMPBUF_UNWINDS(jmpbuf, address)		\
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf)[7])
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/sparc/sparc32/jmpbuf-unwind.h b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
index 3ec444a..da07467 100644
--- a/sysdeps/sparc/sparc32/jmpbuf-unwind.h
+++ b/sysdeps/sparc/sparc32/jmpbuf-unwind.h
@@ -24,8 +24,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((int) (address) < demangle ((jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/sparc/sparc64/jmpbuf-unwind.h b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
index 6635333..9205be9 100644
--- a/sysdeps/sparc/sparc64/jmpbuf-unwind.h
+++ b/sysdeps/sparc/sparc64/jmpbuf-unwind.h
@@ -22,7 +22,7 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle)			\
+#define _JMPBUF_UNWINDS(jmpbuf, address)			\
   ((unsigned long int) (address) < (jmpbuf)->uc_mcontext.mc_gregs[MC_O6] + 2047)
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
diff --git a/sysdeps/tile/jmpbuf-unwind.h b/sysdeps/tile/jmpbuf-unwind.h
index 3925e90..943f9b0 100644
--- a/sysdeps/tile/jmpbuf-unwind.h
+++ b/sysdeps/tile/jmpbuf-unwind.h
@@ -25,8 +25,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_SP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, (void *) _Unwind_GetCFA (_context), _adj)
diff --git a/sysdeps/x86_64/jmpbuf-unwind.h b/sysdeps/x86_64/jmpbuf-unwind.h
index 757ab8d..c0a5752 100644
--- a/sysdeps/x86_64/jmpbuf-unwind.h
+++ b/sysdeps/x86_64/jmpbuf-unwind.h
@@ -24,8 +24,8 @@ 
 
 /* Test if longjmp to JMPBUF would unwind the frame
    containing a local variable at ADDRESS.  */
-#define _JMPBUF_UNWINDS(jmpbuf, address, demangle) \
-  ((void *) (address) < (void *) demangle ((jmpbuf)[JB_RSP]))
+#define _JMPBUF_UNWINDS(jmpbuf, address) \
+  ((uintptr_t) (address) < _jmpbuf_sp (jmpbuf))
 
 #define _JMPBUF_CFA_UNWINDS_ADJ(_jmpbuf, _context, _adj) \
   _JMPBUF_UNWINDS_ADJ (_jmpbuf, \