about summary refs log tree commit diff
path: root/sysdeps/x86
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-08 17:31:08 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-08-31 09:04:27 -0300
commit8cd559cf5afe3894f92c2be6f972e1a4e38c56ca (patch)
treec2f781b04f9ddad1012a60eecb5facca19410e5c /sysdeps/x86
parentc7509d49c4e8fa494120c5ead21338559dad16f5 (diff)
downloadglibc-8cd559cf5afe3894f92c2be6f972e1a4e38c56ca.tar.gz
glibc-8cd559cf5afe3894f92c2be6f972e1a4e38c56ca.tar.xz
glibc-8cd559cf5afe3894f92c2be6f972e1a4e38c56ca.zip
nptl: x86_64: Use same code for CURRENT_STACK_FRAME and stackinfo_get_sp
It avoids the possible warning of uninitialized 'frame' variable when
building with clang:

  ../sysdeps/nptl/jmp-unwind.c:27:42: error: variable 'frame' is
  uninitialized when used here [-Werror,-Wuninitialized]
    __pthread_cleanup_upto (env->__jmpbuf, CURRENT_STACK_FRAME);

The resulting code is similar to CURRENT_STACK_FRAME.

Checked on x86_64-linux-gnu.
Diffstat (limited to 'sysdeps/x86')
-rw-r--r--sysdeps/x86/nptl/pthreaddef.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/sysdeps/x86/nptl/pthreaddef.h b/sysdeps/x86/nptl/pthreaddef.h
index 63fdbcb27c..7df65931a3 100644
--- a/sysdeps/x86/nptl/pthreaddef.h
+++ b/sysdeps/x86/nptl/pthreaddef.h
@@ -42,7 +42,9 @@
 #ifdef __x86_64__
 /* The frame pointer is not usable.  */
 # define CURRENT_STACK_FRAME \
-  ({ register char *frame __asm__("rsp"); frame; })
+  ({ register void * p__ __asm__(RSP_REG); \
+     asm volatile("" : "=r" (p__)); \
+     p__; })
 #else
 # define CURRENT_STACK_FRAME	__builtin_frame_address (0)
 #endif