mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-01-19 04:49:25 +08:00
Remove _global_impure_ptr indirection
Remove the pointer indirection through the read-only _global_impure_ptr and directly use a externally visible _impure_data object of type struct _reent. This enables the static initialization of global data structures in a follow up patch. In addition, we get rid of a machine-specific file.
This commit is contained in:
parent
357d7fcc6a
commit
ad51d0006a
@ -816,7 +816,7 @@ check_PROGRAMS =
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/ferror.c libc/machine/spu/fflush.c libc/machine/spu/fgetc.c libc/machine/spu/fgetpos.c libc/machine/spu/fgets.c libc/machine/spu/fileno.c libc/machine/spu/fiprintf.S \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/fiscanf.S libc/machine/spu/fopen.c libc/machine/spu/fprintf.S libc/machine/spu/fputc.c libc/machine/spu/fputs.c libc/machine/spu/fread.c libc/machine/spu/freopen.c \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/fscanf.S libc/machine/spu/fseek.c libc/machine/spu/fsetpos.c libc/machine/spu/ftell.c libc/machine/spu/fwrite.c libc/machine/spu/getc.c libc/machine/spu/getchar.c \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/gets.c libc/machine/spu/impure.c libc/machine/spu/iprintf.S libc/machine/spu/iscanf.S libc/machine/spu/memcmp.c libc/machine/spu/memcpy.c libc/machine/spu/memmove.c \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/gets.c libc/machine/spu/iprintf.S libc/machine/spu/iscanf.S libc/machine/spu/memcmp.c libc/machine/spu/memcpy.c libc/machine/spu/memmove.c \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/memset.c libc/machine/spu/perror.c libc/machine/spu/printf.S libc/machine/spu/putc.c libc/machine/spu/putchar.c libc/machine/spu/puts.c libc/machine/spu/remove.c \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/rename.c libc/machine/spu/rewind.c libc/machine/spu/scanf.S libc/machine/spu/setbuf.c libc/machine/spu/setvbuf.c libc/machine/spu/siprintf.S libc/machine/spu/siscanf.S \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/sleep.c libc/machine/spu/sniprintf.S libc/machine/spu/snprintf.S libc/machine/spu/sprintf.S libc/machine/spu/sscanf.S libc/machine/spu/stdio.c libc/machine/spu/strcat.c \
|
||||
@ -2131,7 +2131,6 @@ am__objects_51 = libc/ssp/libc_a-chk_fail.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-getc.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-getchar.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-gets.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-impure.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-iprintf.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-iscanf.$(OBJEXT) \
|
||||
@HAVE_LIBC_MACHINE_SPU_TRUE@ libc/machine/spu/libc_a-memcmp.$(OBJEXT) \
|
||||
@ -8812,9 +8811,6 @@ libc/machine/spu/libc_a-getchar.$(OBJEXT): \
|
||||
libc/machine/spu/libc_a-gets.$(OBJEXT): \
|
||||
libc/machine/spu/$(am__dirstamp) \
|
||||
libc/machine/spu/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/machine/spu/libc_a-impure.$(OBJEXT): \
|
||||
libc/machine/spu/$(am__dirstamp) \
|
||||
libc/machine/spu/$(DEPDIR)/$(am__dirstamp)
|
||||
libc/machine/spu/libc_a-iprintf.$(OBJEXT): \
|
||||
libc/machine/spu/$(am__dirstamp) \
|
||||
libc/machine/spu/$(DEPDIR)/$(am__dirstamp)
|
||||
@ -12121,7 +12117,6 @@ distclean-compile:
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-getc.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-getchar.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-gets.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-impure.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-iprintf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-iscanf.Po@am__quote@
|
||||
@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-malloc_ea.Po@am__quote@
|
||||
@ -33451,20 +33446,6 @@ libc/machine/spu/libc_a-gets.obj: libc/machine/spu/gets.c
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/machine/spu/libc_a-gets.obj `if test -f 'libc/machine/spu/gets.c'; then $(CYGPATH_W) 'libc/machine/spu/gets.c'; else $(CYGPATH_W) '$(srcdir)/libc/machine/spu/gets.c'; fi`
|
||||
|
||||
libc/machine/spu/libc_a-impure.o: libc/machine/spu/impure.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/machine/spu/libc_a-impure.o -MD -MP -MF libc/machine/spu/$(DEPDIR)/libc_a-impure.Tpo -c -o libc/machine/spu/libc_a-impure.o `test -f 'libc/machine/spu/impure.c' || echo '$(srcdir)/'`libc/machine/spu/impure.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/machine/spu/$(DEPDIR)/libc_a-impure.Tpo libc/machine/spu/$(DEPDIR)/libc_a-impure.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/machine/spu/impure.c' object='libc/machine/spu/libc_a-impure.o' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/machine/spu/libc_a-impure.o `test -f 'libc/machine/spu/impure.c' || echo '$(srcdir)/'`libc/machine/spu/impure.c
|
||||
|
||||
libc/machine/spu/libc_a-impure.obj: libc/machine/spu/impure.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/machine/spu/libc_a-impure.obj -MD -MP -MF libc/machine/spu/$(DEPDIR)/libc_a-impure.Tpo -c -o libc/machine/spu/libc_a-impure.obj `if test -f 'libc/machine/spu/impure.c'; then $(CYGPATH_W) 'libc/machine/spu/impure.c'; else $(CYGPATH_W) '$(srcdir)/libc/machine/spu/impure.c'; fi`
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/machine/spu/$(DEPDIR)/libc_a-impure.Tpo libc/machine/spu/$(DEPDIR)/libc_a-impure.Po
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='libc/machine/spu/impure.c' object='libc/machine/spu/libc_a-impure.obj' libtool=no @AMDEPBACKSLASH@
|
||||
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
|
||||
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -c -o libc/machine/spu/libc_a-impure.obj `if test -f 'libc/machine/spu/impure.c'; then $(CYGPATH_W) 'libc/machine/spu/impure.c'; else $(CYGPATH_W) '$(srcdir)/libc/machine/spu/impure.c'; fi`
|
||||
|
||||
libc/machine/spu/libc_a-memcmp.o: libc/machine/spu/memcmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/machine/spu/libc_a-memcmp.o -MD -MP -MF libc/machine/spu/$(DEPDIR)/libc_a-memcmp.Tpo -c -o libc/machine/spu/libc_a-memcmp.o `test -f 'libc/machine/spu/memcmp.c' || echo '$(srcdir)/'`libc/machine/spu/memcmp.c
|
||||
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/machine/spu/$(DEPDIR)/libc_a-memcmp.Tpo libc/machine/spu/$(DEPDIR)/libc_a-memcmp.Po
|
||||
|
@ -821,7 +821,12 @@ extern __FILE __sf[3];
|
||||
#endif
|
||||
|
||||
extern struct _reent *_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
|
||||
extern struct _reent *const _global_impure_ptr __ATTRIBUTE_IMPURE_PTR__;
|
||||
|
||||
#ifndef __ATTRIBUTE_IMPURE_DATA__
|
||||
#define __ATTRIBUTE_IMPURE_DATA__
|
||||
#endif
|
||||
|
||||
extern struct _reent _impure_data __ATTRIBUTE_IMPURE_DATA__;
|
||||
|
||||
void _reclaim_reent (struct _reent *);
|
||||
|
||||
@ -836,7 +841,7 @@ void _reclaim_reent (struct _reent *);
|
||||
# define _REENT _impure_ptr
|
||||
#endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */
|
||||
|
||||
#define _GLOBAL_REENT _global_impure_ptr
|
||||
#define _GLOBAL_REENT (&_impure_data)
|
||||
|
||||
#ifdef _REENT_GLOBAL_ATEXIT
|
||||
extern struct _atexit *_global_atexit; /* points to head of LIFO stack */
|
||||
|
@ -3,7 +3,7 @@ libc_a_SOURCES += \
|
||||
%D%/ferror.c %D%/fflush.c %D%/fgetc.c %D%/fgetpos.c %D%/fgets.c %D%/fileno.c %D%/fiprintf.S \
|
||||
%D%/fiscanf.S %D%/fopen.c %D%/fprintf.S %D%/fputc.c %D%/fputs.c %D%/fread.c %D%/freopen.c \
|
||||
%D%/fscanf.S %D%/fseek.c %D%/fsetpos.c %D%/ftell.c %D%/fwrite.c %D%/getc.c %D%/getchar.c \
|
||||
%D%/gets.c %D%/impure.c %D%/iprintf.S %D%/iscanf.S %D%/memcmp.c %D%/memcpy.c %D%/memmove.c \
|
||||
%D%/gets.c %D%/iprintf.S %D%/iscanf.S %D%/memcmp.c %D%/memcpy.c %D%/memmove.c \
|
||||
%D%/memset.c %D%/perror.c %D%/printf.S %D%/putc.c %D%/putchar.c %D%/puts.c %D%/remove.c \
|
||||
%D%/rename.c %D%/rewind.c %D%/scanf.S %D%/setbuf.c %D%/setvbuf.c %D%/siprintf.S %D%/siscanf.S \
|
||||
%D%/sleep.c %D%/sniprintf.S %D%/snprintf.S %D%/sprintf.S %D%/sscanf.S %D%/stdio.c %D%/strcat.c \
|
||||
|
@ -1,14 +0,0 @@
|
||||
#include <reent.h>
|
||||
|
||||
/* Note that there is a copy of this in sys/reent.h. */
|
||||
#ifndef __ATTRIBUTE_IMPURE_PTR__
|
||||
#define __ATTRIBUTE_IMPURE_PTR__
|
||||
#endif
|
||||
|
||||
#ifndef __ATTRIBUTE_IMPURE_DATA__
|
||||
#define __ATTRIBUTE_IMPURE_DATA__
|
||||
#endif
|
||||
|
||||
struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT(_impure_data);
|
||||
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data;
|
||||
struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &_impure_data;
|
@ -27,7 +27,6 @@ extern "C" {
|
||||
|
||||
#include <sys/reent.h>
|
||||
|
||||
extern struct _reent _impure_data;
|
||||
#define errno (_impure_data._errno)
|
||||
|
||||
/* Please don't use these variables directly.
|
||||
|
@ -1,14 +1,5 @@
|
||||
#include <reent.h>
|
||||
|
||||
/* Note that there is a copy of this in sys/reent.h. */
|
||||
#ifndef __ATTRIBUTE_IMPURE_PTR__
|
||||
#define __ATTRIBUTE_IMPURE_PTR__
|
||||
#endif
|
||||
|
||||
#ifndef __ATTRIBUTE_IMPURE_DATA__
|
||||
#define __ATTRIBUTE_IMPURE_DATA__
|
||||
#endif
|
||||
|
||||
/* Redeclare these symbols locally as weak so that the file containing
|
||||
their definitions (along with a lot of other stuff) isn't sucked in
|
||||
unless they are actually used by other compilation units. This is
|
||||
@ -20,9 +11,8 @@ extern const struct __sFILE_fake __sf_fake_stdout _ATTRIBUTE ((weak));
|
||||
extern const struct __sFILE_fake __sf_fake_stderr _ATTRIBUTE ((weak));
|
||||
#endif
|
||||
|
||||
static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data = _REENT_INIT (impure_data);
|
||||
struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data = _REENT_INIT (_impure_data);
|
||||
#ifdef __CYGWIN__
|
||||
extern struct _reent reent_data __attribute__ ((alias("impure_data")));
|
||||
extern struct _reent reent_data __attribute__ ((alias("_impure_data")));
|
||||
#endif
|
||||
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &impure_data;
|
||||
struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr = &impure_data;
|
||||
struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr = &_impure_data;
|
||||
|
@ -816,7 +816,7 @@ static inline void
|
||||
main_thread_sinit ()
|
||||
{
|
||||
__sinit (_impure_ptr);
|
||||
/* At this point, _impure_ptr == _global_impure_ptr == _GLOBAL_REENT is
|
||||
/* At this point, _impure_ptr == _GLOBAL_REENT is
|
||||
initialized, but _REENT == _my_tls.local_clib doesn't know about it.
|
||||
It has been copied over from _GLOBAL_REENT in _cygtls::init_thread
|
||||
*before* the initialization took place.
|
||||
|
Loading…
x
Reference in New Issue
Block a user