diff --git a/newlib/libc/reent/getreent.c b/newlib/libc/reent/getreent.c index 60ae6fbb7..176923226 100644 --- a/newlib/libc/reent/getreent.c +++ b/newlib/libc/reent/getreent.c @@ -1,5 +1,4 @@ /* default reentrant pointer when multithread enabled */ - #include <_ansi.h> #include @@ -10,5 +9,11 @@ struct _reent * _DEFUN_VOID(__getreent) { +#ifdef __CYGWIN__ + /* Utilize Cygwin's inline definition from include/cygwin/config.h + (note the extra underscore) */ + return __inline_getreent (); +#else return _impure_ptr; +#endif } diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h index c09641ed1..585a2567f 100644 --- a/winsup/cygwin/include/cygwin/config.h +++ b/winsup/cygwin/include/cygwin/config.h @@ -42,7 +42,7 @@ extern "C" { #include "../tlsoffsets.h" #endif __attribute__((gnu_inline)) -extern inline struct _reent *__getreent (void) +extern inline struct _reent *__inline_getreent (void) { register char *ret; #ifdef __x86_64__ @@ -52,6 +52,7 @@ extern inline struct _reent *__getreent (void) #endif return (struct _reent *) (ret + tls_local_clib); } +#define __getreent() __inline_getreent() #endif /* _COMPILING_NEWLIB */ #ifdef __x86_64__