From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dedi548.your-server.de (dedi548.your-server.de [85.10.215.148]) by sourceware.org (Postfix) with ESMTPS id 9C2903856DC6 for ; Tue, 3 May 2022 13:40:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C2903856DC6 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embedded-brains.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=embedded-brains.de Received: from sslproxy06.your-server.de ([78.46.172.3]) by dedi548.your-server.de with esmtpsa (TLS1.3) tls TLS_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1nlsli-000I5B-NH for newlib@sourceware.org; Tue, 03 May 2022 15:40:47 +0200 Received: from [82.100.198.138] (helo=mail.embedded-brains.de) by sslproxy06.your-server.de with esmtpsa (TLSv1.3:TLS_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nlsli-0003cb-KC for newlib@sourceware.org; Tue, 03 May 2022 15:40:46 +0200 Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 53EB5480059 for ; Tue, 3 May 2022 15:40:46 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id aNYkSpRdGGUU for ; Tue, 3 May 2022 15:40:45 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 8A4204800F4 for ; Tue, 3 May 2022 15:40:45 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.eb.localhost Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5Zx6vqSvZHzS for ; Tue, 3 May 2022 15:40:45 +0200 (CEST) Received: from zimbra.eb.localhost (unknown [192.168.96.242]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 698BE480059 for ; Tue, 3 May 2022 15:40:45 +0200 (CEST) From: Sebastian Huber To: newlib@sourceware.org Subject: [PATCH] Remove use of _global_impure_ptr Date: Tue, 3 May 2022 15:40:43 +0200 Message-Id: <20220503134043.122345-1-sebastian.huber@embedded-brains.de> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-Authenticated-Sender: smtp-embedded@poldinet.de X-Virus-Scanned: Clear (ClamAV 0.103.5/26530/Tue May 3 10:12:27 2022) X-Spam-Status: No, score=-11.3 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: newlib@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 03 May 2022 13:40:52 -0000 Remove the pointer indrection through the read-only _global_impure_ptr an= d directly use a globally visible _impure_data object of type struct reent.= This enables the static initialization of global data structures in a follow u= p patch. In addition, we get rid of a machine-specific file. --- newlib/Makefile.in | 42 ++++++++++++++-------------- newlib/libc/include/sys/reent.h | 9 ++++-- newlib/libc/machine/spu/Makefile.inc | 2 +- newlib/libc/machine/spu/impure.c | 14 ---------- newlib/libc/machine/spu/sys/errno.h | 1 - newlib/libc/reent/Makefile.inc | 1 + newlib/libc/reent/impure-compat.c | 5 ++++ newlib/libc/reent/impure.c | 16 ++--------- winsup/cygwin/dcrt0.cc | 2 +- 9 files changed, 39 insertions(+), 53 deletions(-) delete mode 100644 newlib/libc/machine/spu/impure.c create mode 100644 newlib/libc/reent/impure-compat.c diff --git a/newlib/Makefile.in b/newlib/Makefile.in index 41e41412b..aa0e710a6 100644 --- a/newlib/Makefile.in +++ b/newlib/Makefile.in @@ -816,7 +816,7 @@ check_PROGRAMS =3D @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/im= pure.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/ip= rintf.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/s= pu/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/s= niprintf.S libc/machine/spu/snprintf.S libc/machine/spu/sprintf.S libc/ma= chine/spu/sscanf.S libc/machine/spu/stdio.c libc/machine/spu/strcat.c \ @@ -2131,7 +2131,6 @@ am__objects_51 =3D libc/ssp/libc_a-chk_fail.$(OBJEX= T) \ @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) \ @@ -2506,6 +2505,7 @@ am_libc_a_OBJECTS =3D $(am__objects_1) \ libc/reent/libc_a-closer.$(OBJEXT) \ libc/reent/libc_a-reent.$(OBJEXT) \ libc/reent/libc_a-impure.$(OBJEXT) \ + libc/reent/libc_a-impure-compat.$(OBJEXT) \ libc/reent/libc_a-fcntlr.$(OBJEXT) \ libc/reent/libc_a-fstatr.$(OBJEXT) \ libc/reent/libc_a-getreent.$(OBJEXT) \ @@ -3900,7 +3900,8 @@ libc_a_SOURCES =3D $(am__append_6) libc/stdlib/__ad= just.c \ libc/time/tzset_r.c libc/time/tzvars.c libc/time/wcsftime.c \ libc/locale/setlocale.h libc/locale/locale.c \ libc/locale/localeconv.c $(am__append_20) libc/reent/closer.c \ - libc/reent/reent.c libc/reent/impure.c libc/reent/fcntlr.c \ + libc/reent/reent.c libc/reent/impure.c \ + libc/reent/impure-compat.c libc/reent/fcntlr.c \ libc/reent/fstatr.c libc/reent/getreent.c \ libc/reent/gettimeofdayr.c libc/reent/isattyr.c \ libc/reent/linkr.c libc/reent/lseekr.c libc/reent/mkdirr.c \ @@ -6161,6 +6162,8 @@ libc/reent/libc_a-reent.$(OBJEXT): libc/reent/$(am_= _dirstamp) \ libc/reent/$(DEPDIR)/$(am__dirstamp) libc/reent/libc_a-impure.$(OBJEXT): libc/reent/$(am__dirstamp) \ libc/reent/$(DEPDIR)/$(am__dirstamp) +libc/reent/libc_a-impure-compat.$(OBJEXT): libc/reent/$(am__dirstamp) \ + libc/reent/$(DEPDIR)/$(am__dirstamp) libc/reent/libc_a-fcntlr.$(OBJEXT): libc/reent/$(am__dirstamp) \ libc/reent/$(DEPDIR)/$(am__dirstamp) libc/reent/libc_a-fstatr.$(OBJEXT): libc/reent/$(am__dirstamp) \ @@ -8812,9 +8815,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 +12121,6 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-g= etc.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-g= etchar.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-g= ets.Po@am__quote@ -@AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-i= mpure.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-i= printf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-i= scanf.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/machine/spu/$(DEPDIR)/libc_a-m= alloc_ea.Po@am__quote@ @@ -12309,6 +12308,7 @@ distclean-compile: @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-fstatr.= Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-getreen= t.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-gettime= ofdayr.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-impure-= compat.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-impure.= Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-isattyr= .Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@libc/reent/$(DEPDIR)/libc_a-linkr.P= o@am__quote@ @@ -26801,6 +26801,20 @@ libc/reent/libc_a-impure.obj: libc/reent/impure.= c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS= ) -c -o libc/reent/libc_a-impure.obj `if test -f 'libc/reent/impure.c'; t= hen $(CYGPATH_W) 'libc/reent/impure.c'; else $(CYGPATH_W) '$(srcdir)/libc= /reent/impure.c'; fi` =20 +libc/reent/libc_a-impure-compat.o: libc/reent/impure-compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/r= eent/libc_a-impure-compat.o -MD -MP -MF libc/reent/$(DEPDIR)/libc_a-impur= e-compat.Tpo -c -o libc/reent/libc_a-impure-compat.o `test -f 'libc/reent= /impure-compat.c' || echo '$(srcdir)/'`libc/reent/impure-compat.c +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/reent/$(DEPDIR)/libc_a-imp= ure-compat.Tpo libc/reent/$(DEPDIR)/libc_a-impure-compat.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=3D'libc/reent/impure-= compat.c' object=3D'libc/reent/libc_a-impure-compat.o' libtool=3Dno @AMDE= PBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS= ) -c -o libc/reent/libc_a-impure-compat.o `test -f 'libc/reent/impure-com= pat.c' || echo '$(srcdir)/'`libc/reent/impure-compat.c + +libc/reent/libc_a-impure-compat.obj: libc/reent/impure-compat.c +@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/r= eent/libc_a-impure-compat.obj -MD -MP -MF libc/reent/$(DEPDIR)/libc_a-imp= ure-compat.Tpo -c -o libc/reent/libc_a-impure-compat.obj `if test -f 'lib= c/reent/impure-compat.c'; then $(CYGPATH_W) 'libc/reent/impure-compat.c';= else $(CYGPATH_W) '$(srcdir)/libc/reent/impure-compat.c'; fi` +@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/reent/$(DEPDIR)/libc_a-imp= ure-compat.Tpo libc/reent/$(DEPDIR)/libc_a-impure-compat.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source=3D'libc/reent/impure-= compat.c' object=3D'libc/reent/libc_a-impure-compat.obj' libtool=3Dno @AM= DEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS= ) -c -o libc/reent/libc_a-impure-compat.obj `if test -f 'libc/reent/impur= e-compat.c'; then $(CYGPATH_W) 'libc/reent/impure-compat.c'; else $(CYGPA= TH_W) '$(srcdir)/libc/reent/impure-compat.c'; fi` + libc/reent/libc_a-fcntlr.o: libc/reent/fcntlr.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/r= eent/libc_a-fcntlr.o -MD -MP -MF libc/reent/$(DEPDIR)/libc_a-fcntlr.Tpo -= c -o libc/reent/libc_a-fcntlr.o `test -f 'libc/reent/fcntlr.c' || echo '$= (srcdir)/'`libc/reent/fcntlr.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) libc/reent/$(DEPDIR)/libc_a-fcn= tlr.Tpo libc/reent/$(DEPDIR)/libc_a-fcntlr.Po @@ -33451,20 +33465,6 @@ libc/machine/spu/libc_a-gets.obj: libc/machine/s= pu/gets.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS= ) -c -o libc/machine/spu/libc_a-gets.obj `if test -f 'libc/machine/spu/ge= ts.c'; then $(CYGPATH_W) 'libc/machine/spu/gets.c'; else $(CYGPATH_W) '$(= srcdir)/libc/machine/spu/gets.c'; fi` =20 -libc/machine/spu/libc_a-impure.o: libc/machine/spu/impure.c -@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/m= achine/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=3D'libc/machine/spu/i= mpure.c' object=3D'libc/machine/spu/libc_a-impure.o' libtool=3Dno @AMDEPB= ACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(INCLUDES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS= ) -c -o libc/machine/spu/libc_a-impure.o `test -f 'libc/machine/spu/impur= e.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) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/m= achine/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/m= achine/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=3D'libc/machine/spu/i= mpure.c' object=3D'libc/machine/spu/libc_a-impure.obj' libtool=3Dno @AMDE= PBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=3D$(DEPDIR) $(CCDEPMODE) $(depc= omp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLU= DES) $(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) $(INCLU= DES) $(libc_a_CPPFLAGS) $(CPPFLAGS) $(libc_a_CFLAGS) $(CFLAGS) -MT libc/m= achine/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 diff --git a/newlib/libc/include/sys/reent.h b/newlib/libc/include/sys/re= ent.h index f8ecf8586..4bc78a447 100644 --- a/newlib/libc/include/sys/reent.h +++ b/newlib/libc/include/sys/reent.h @@ -821,7 +821,12 @@ extern __FILE __sf[3]; #endif =20 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__; =20 void _reclaim_reent (struct _reent *); =20 @@ -836,7 +841,7 @@ void _reclaim_reent (struct _reent *); # define _REENT _impure_ptr #endif /* __SINGLE_THREAD__ || !__DYNAMIC_REENT__ */ =20 -#define _GLOBAL_REENT _global_impure_ptr +#define _GLOBAL_REENT (&_impure_data) =20 #ifdef _REENT_GLOBAL_ATEXIT extern struct _atexit *_global_atexit; /* points to head of LIFO stack *= / diff --git a/newlib/libc/machine/spu/Makefile.inc b/newlib/libc/machine/s= pu/Makefile.inc index bc84e9a23..5384a5f28 100644 --- a/newlib/libc/machine/spu/Makefile.inc +++ b/newlib/libc/machine/spu/Makefile.inc @@ -3,7 +3,7 @@ libc_a_SOURCES +=3D \ %D%/ferror.c %D%/fflush.c %D%/fgetc.c %D%/fgetpos.c %D%/fgets.c %D%/fil= eno.c %D%/fiprintf.S \ %D%/fiscanf.S %D%/fopen.c %D%/fprintf.S %D%/fputc.c %D%/fputs.c %D%/fre= ad.c %D%/freopen.c \ %D%/fscanf.S %D%/fseek.c %D%/fsetpos.c %D%/ftell.c %D%/fwrite.c %D%/get= c.c %D%/getchar.c \ - %D%/gets.c %D%/impure.c %D%/iprintf.S %D%/iscanf.S %D%/memcmp.c %D%/mem= cpy.c %D%/memmove.c \ + %D%/gets.c %D%/iprintf.S %D%/iscanf.S %D%/memcmp.c %D%/memcpy.c %D%/mem= move.c \ %D%/memset.c %D%/perror.c %D%/printf.S %D%/putc.c %D%/putchar.c %D%/put= s.c %D%/remove.c \ %D%/rename.c %D%/rewind.c %D%/scanf.S %D%/setbuf.c %D%/setvbuf.c %D%/si= printf.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 \ diff --git a/newlib/libc/machine/spu/impure.c b/newlib/libc/machine/spu/i= mpure.c deleted file mode 100644 index f9c86efdc..000000000 --- a/newlib/libc/machine/spu/impure.c +++ /dev/null @@ -1,14 +0,0 @@ -#include - -/* 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 =3D _REENT_INIT(_im= pure_data); -struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr =3D &_impure_data; -struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr =3D &_i= mpure_data; diff --git a/newlib/libc/machine/spu/sys/errno.h b/newlib/libc/machine/sp= u/sys/errno.h index ef087bd68..b008ff6f4 100644 --- a/newlib/libc/machine/spu/sys/errno.h +++ b/newlib/libc/machine/spu/sys/errno.h @@ -27,7 +27,6 @@ extern "C" { =20 #include =20 -extern struct _reent _impure_data; #define errno (_impure_data._errno) =20 /* Please don't use these variables directly. diff --git a/newlib/libc/reent/Makefile.inc b/newlib/libc/reent/Makefile.= inc index b4b7f7596..46ab7fe79 100644 --- a/newlib/libc/reent/Makefile.inc +++ b/newlib/libc/reent/Makefile.inc @@ -2,6 +2,7 @@ libc_a_SOURCES +=3D \ %D%/closer.c \ %D%/reent.c \ %D%/impure.c \ + %D%/impure-compat.c \ %D%/fcntlr.c \ %D%/fstatr.c \ %D%/getreent.c \ diff --git a/newlib/libc/reent/impure-compat.c b/newlib/libc/reent/impure= -compat.c new file mode 100644 index 000000000..3f3fa3742 --- /dev/null +++ b/newlib/libc/reent/impure-compat.c @@ -0,0 +1,5 @@ +#include + +/* Provided for backward binary compatibility */ +struct _reent *const __ATTRIBUTE_IMPURE_PTR__ +_global_impure_ptr =3D &_impure_data; diff --git a/newlib/libc/reent/impure.c b/newlib/libc/reent/impure.c index 76f67459e..f10665fd0 100644 --- a/newlib/libc/reent/impure.c +++ b/newlib/libc/reent/impure.c @@ -1,14 +1,5 @@ #include =20 -/* 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 _ATTR= IBUTE ((weak)); extern const struct __sFILE_fake __sf_fake_stderr _ATTRIBUTE ((weak)); #endif =20 -static struct _reent __ATTRIBUTE_IMPURE_DATA__ impure_data =3D _REENT_IN= IT (impure_data); +struct _reent __ATTRIBUTE_IMPURE_DATA__ _impure_data =3D _REENT_INIT (_i= mpure_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 =3D &impure_data; -struct _reent *const __ATTRIBUTE_IMPURE_PTR__ _global_impure_ptr =3D &im= pure_data; +struct _reent *__ATTRIBUTE_IMPURE_PTR__ _impure_ptr =3D &_impure_data; diff --git a/winsup/cygwin/dcrt0.cc b/winsup/cygwin/dcrt0.cc index e757c47ec..aeb81a5cd 100644 --- a/winsup/cygwin/dcrt0.cc +++ b/winsup/cygwin/dcrt0.cc @@ -816,7 +816,7 @@ static inline void main_thread_sinit () { __sinit (_impure_ptr); - /* At this point, _impure_ptr =3D=3D _global_impure_ptr =3D=3D _GLOBAL= _REENT is + /* At this point, _impure_ptr =3D=3D _GLOBAL_REENT is initialized, but _REENT =3D=3D _my_tls.local_clib doesn't know abou= t it. It has been copied over from _GLOBAL_REENT in _cygtls::init_thread *before* the initialization took place. --=20 2.34.1