From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1521) id A36813858D39; Wed, 2 Mar 2022 01:31:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A36813858D39 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Frysinger To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] newlib: convert INTERNAL_NEWLIB to _LIBC X-Act-Checkin: newlib-cygwin X-Git-Author: Mike Frysinger X-Git-Refname: refs/heads/master X-Git-Oldrev: e15b2e8691cb26b7ecf8b7ea3d52e508c3be6625 X-Git-Newrev: dea52d5c1e03586181f60beb93de2564cc5f3c0e Message-Id: <20220302013131.A36813858D39@sourceware.org> Date: Wed, 2 Mar 2022 01:31:31 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Mar 2022 01:31:31 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3Ddea52d5c1e0= 3586181f60beb93de2564cc5f3c0e commit dea52d5c1e03586181f60beb93de2564cc5f3c0e Author: Mike Frysinger Date: Mon Feb 28 20:18:39 2022 -0500 newlib: convert INTERNAL_NEWLIB to _LIBC =20 Since we already set up _LIBC to indicate source files are building for newlib, we don't need this malloc-specific symbol. Convert it over to simplify the build a bit. Diff: --- newlib/libc/stdlib/Makefile.am | 26 ++++++++++++-------------- newlib/libc/stdlib/Makefile.in | 25 ++++++++++++------------- newlib/libc/stdlib/mallocr.c | 22 +++++++++++----------- newlib/libc/stdlib/nano-mallocr.c | 6 +++--- 4 files changed, 38 insertions(+), 41 deletions(-) diff --git a/newlib/libc/stdlib/Makefile.am b/newlib/libc/stdlib/Makefile.am index 771ce7c7f..50e22d90c 100644 --- a/newlib/libc/stdlib/Makefile.am +++ b/newlib/libc/stdlib/Makefile.am @@ -208,43 +208,41 @@ lib_a_CFLAGS =3D $(AM_CFLAGS) lib_a_DEPENDENCIES =3D $(LIBADD_OBJS) $(ELIX_OBJS) LIB_COMPILE =3D $(AM_V_CC)$(COMPILE) =20 -MALLOC_COMPILE =3D $(LIB_COMPILE) -DINTERNAL_NEWLIB - $(lpfx)$(MALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(FREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(REALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(CALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(CFREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALIGNR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(VALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(PVALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLINFOR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLSTATSR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MSIZER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -= o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLOPTR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)dtoa.o: dtoa.c mprec.h $(lpfx)ldtoa.o: ldtoa.c mprec.h gdtoa.h diff --git a/newlib/libc/stdlib/Makefile.in b/newlib/libc/stdlib/Makefile.in index 5fbc478fb..9b873ef55 100644 --- a/newlib/libc/stdlib/Makefile.in +++ b/newlib/libc/stdlib/Makefile.in @@ -513,7 +513,6 @@ lib_a_LIBADD =3D $(LIBADD_OBJS) $(ELIX_OBJS) lib_a_CFLAGS =3D $(AM_CFLAGS) lib_a_DEPENDENCIES =3D $(LIBADD_OBJS) $(ELIX_OBJS) LIB_COMPILE =3D $(AM_V_CC)$(COMPILE) -MALLOC_COMPILE =3D $(LIB_COMPILE) -DINTERNAL_NEWLIB all: all-am =20 .SUFFIXES: @@ -1501,40 +1500,40 @@ uninstall-am: =20 =20 $(lpfx)$(MALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(FREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(REALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(CALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(CFREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALIGNR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(VALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(PVALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLINFOR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLSTATSR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MSIZER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -= o $@ + $(LIB_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)$(MALLOPTR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ =20 $(lpfx)dtoa.o: dtoa.c mprec.h $(lpfx)ldtoa.o: ldtoa.c mprec.h gdtoa.h diff --git a/newlib/libc/stdlib/mallocr.c b/newlib/libc/stdlib/mallocr.c index 13d014cc8..6167433c8 100644 --- a/newlib/libc/stdlib/mallocr.c +++ b/newlib/libc/stdlib/mallocr.c @@ -209,7 +209,7 @@ int _dummy_mallocr =3D 1; (for example, internally, `malloc' is named `mALLOc') needed when compiling in this case. These look funny but don't otherwise affect anything. - INTERNAL_NEWLIB (default: NOT defined) + _LIBC (default: NOT defined) Defined only when compiled as part of the Cygnus newlib distribution. WIN32 (default: undefined) @@ -291,7 +291,7 @@ extern "C" { =20 */ =20 -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC =20 #include =20 @@ -345,7 +345,7 @@ extern void __malloc_unlock(); #define RCALL reent_ptr, #define RONECALL reent_ptr =20 -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ =20 #define POINTER_UINT unsigned long #define RARG @@ -355,7 +355,7 @@ extern void __malloc_unlock(); #define RCALL #define RONECALL =20 -#endif /* ! INTERNAL_NEWLIB */ +#endif /* ! _LIBC */ =20 /* Debugging: @@ -953,7 +953,7 @@ Void_t *(*__morecore)() =3D __default_morecore_init; =20 #else /* INTERNAL_LINUX_C_LIB */ =20 -#ifndef INTERNAL_NEWLIB +#ifndef _LIBC #if __STD_C extern Void_t* sbrk(ptrdiff_t); #else @@ -1000,7 +1000,7 @@ extern Void_t* sbrk(); =20 #else =20 -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC =20 #define cALLOc _calloc_r #define fREe _free_r @@ -1026,7 +1026,7 @@ extern Void_t* sbrk(); #define malloc_top_pad __malloc_top_pad #define malloc_trim_threshold __malloc_trim_threshold =20 -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ =20 #define cALLOc calloc #define fREe free @@ -1038,7 +1038,7 @@ extern Void_t* sbrk(); #define mALLINFo mallinfo #define mALLOPt mallopt =20 -#endif /* ! INTERNAL_NEWLIB */ +#endif /* ! _LIBC */ #endif =20 /* Public routines */ @@ -3274,14 +3274,14 @@ Void_t* cALLOc(RARG n, elem_size) RDECL size_t n; s= ize_t elem_size; */ =20 #if !defined(INTERNAL_LINUX_C_LIB) || !defined(__ELF__) -#if !defined(INTERNAL_NEWLIB) || !defined(_REENT_ONLY) +#if !defined(_LIBC) || !defined(_REENT_ONLY) #if __STD_C void cfree(Void_t *mem) #else void cfree(mem) Void_t *mem; #endif { -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC fREe(_REENT, mem); #else fREe(mem); @@ -3522,7 +3522,7 @@ void malloc_stats(RONEARG) RDECL #endif MALLOC_UNLOCK; =20 -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC _REENT_SMALL_CHECK_INIT(reent_ptr); fp =3D _stderr_r(reent_ptr); #define fprintf fiprintf diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-ma= llocr.c index 0c5fb2885..7ba1c0abc 100644 --- a/newlib/libc/stdlib/nano-mallocr.c +++ b/newlib/libc/stdlib/nano-mallocr.c @@ -50,7 +50,7 @@ =20 #define _SBRK_R(X) _sbrk_r(X) =20 -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC =20 #include #include @@ -78,7 +78,7 @@ #define nano_mallinfo _mallinfo_r #define nano_mallopt _mallopt_r =20 -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ =20 #define RARG #define RONEARG @@ -100,7 +100,7 @@ #define nano_malloc_stats malloc_stats #define nano_mallinfo mallinfo #define nano_mallopt mallopt -#endif /* ! INTERNAL_NEWLIB */ +#endif /* ! _LIBC */ =20 /* Redefine names to avoid conflict with user names */ #define free_list __malloc_free_list