This is the mail archive of the newlib@sourceware.org mailing list for the newlib 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]

[PATCH 6/6] Cygwin: ___getreent: Expose assembler inline implementation into userspace


From: Corinna Vinschen <corinna@vinschen.de>

Now that we fixed the offsets and now that local_clib is always at the
start of the TLS area, we can use the stack offset of the TLS area as
pointer to the local _reent.

Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
---
 winsup/cygwin/include/cygwin/config.h | 14 +++++---------
 1 file changed, 5 insertions(+), 9 deletions(-)

diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 282637b67130..55f2b2d8964d 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -34,15 +34,10 @@ extern "C" {
    Cygwin internal data structure) into newlib.  The machinery to
    compute these offsets already exists for the sake of gendef so
    we might as well just use it here.  */
+#include <cygwin/_cygtls_padsize.h>
 
-#if defined (_COMPILING_NEWLIB) || defined (__INSIDE_CYGWIN__)
-#ifdef __x86_64__
-#include "../tlsoffsets64.h"
-#else
-#include "../tlsoffsets.h"
-#endif
 __attribute__((__gnu_inline__))
-extern inline struct _reent *__getreent (void)
+extern inline struct _reent *___getreent (void)
 {
   register char *ret;
 #ifdef __x86_64__
@@ -50,9 +45,10 @@ extern inline struct _reent *__getreent (void)
 #else
   __asm __volatile__ ("movl %%fs:4,%0" : "=r" (ret));
 #endif
-  return (struct _reent *) (ret + tls_local_clib);
+  return (struct _reent *) (ret - __CYGTLS_PADSIZE);
 }
-#endif /* _COMPILING_NEWLIB || __INSIDE_CYGWIN__ */
+#undef __getreent
+#define __getreent()	(___getreent())
 
 #ifdef __x86_64__
 # define __SYMBOL_PREFIX
-- 
2.9.5


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