about summary refs log tree commit diff
path: root/sysdeps/x86_64/stackinfo.h
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-02-04 10:29:04 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2020-11-13 12:59:19 -0300
commit01bd62517cc242ae503aaa7002e9e94551803e4d (patch)
tree4eb2b077db03794483dffa01795addead2eb88ef /sysdeps/x86_64/stackinfo.h
parent26f7c72a99f4e46755ec2ff23a6a7cf9c2c337c3 (diff)
downloadglibc-01bd62517cc242ae503aaa7002e9e94551803e4d.tar.gz
glibc-01bd62517cc242ae503aaa7002e9e94551803e4d.tar.xz
glibc-01bd62517cc242ae503aaa7002e9e94551803e4d.zip
Remove tls.h inclusion from internal errno.h
The tls.h inclusion is not really required and limits possible
definition on more arch specific headers.

This is a cleanup to allow inline functions on sysdep.h, more
specifically on i386 and ia64 which requires to access some tls
definitions its own.

No semantic changes expected, checked with a build against all
affected ABIs.
Diffstat (limited to 'sysdeps/x86_64/stackinfo.h')
-rw-r--r--sysdeps/x86_64/stackinfo.h10
1 files changed, 8 insertions, 2 deletions
diff --git a/sysdeps/x86_64/stackinfo.h b/sysdeps/x86_64/stackinfo.h
index 7bcb3b1499..4a4e54cd76 100644
--- a/sysdeps/x86_64/stackinfo.h
+++ b/sysdeps/x86_64/stackinfo.h
@@ -23,6 +23,12 @@
 
 #include <elf.h>
 
+#ifdef __ILP32__
+# define RSP_REG "esp"
+#else
+# define RSP_REG "rsp"
+#endif
+
 /* On x86_64 the stack grows down.  */
 #define _STACK_GROWS_DOWN	1
 
@@ -34,10 +40,10 @@
    for which they need to act as barriers as well, hence the additional
    (unnecessary) parameters.  */
 #define stackinfo_get_sp() \
-  ({ void *p__; asm volatile ("mov %%" RSP_LP ", %0" : "=r" (p__)); p__; })
+  ({ void *p__; asm volatile ("mov %%" RSP_REG ", %0" : "=r" (p__)); p__; })
 #define stackinfo_sub_sp(ptr) \
   ({ ptrdiff_t d__;						\
-     asm volatile ("sub %%" RSP_LP " , %0" : "=r" (d__) : "0" (ptr));	\
+     asm volatile ("sub %%" RSP_REG " , %0" : "=r" (d__) : "0" (ptr));	\
      d__; })
 
 #endif	/* stackinfo.h */