From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183]) by sourceware.org (Postfix) with ESMTP id CAF973858D20 for ; Tue, 1 Mar 2022 01:21:48 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org CAF973858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gentoo.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gentoo.org Received: by smtp.gentoo.org (Postfix, from userid 559) id 466D434351D; Tue, 1 Mar 2022 01:21:48 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH] newlib: convert INTERNAL_NEWLIB to _LIBC Date: Mon, 28 Feb 2022 20:21:50 -0500 Message-Id: <20220301012150.30398-1-vapier@gentoo.org> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_PASS, 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, 01 Mar 2022 01:21:50 -0000 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. --- 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 771ce7c7fe27..50e22d90c0e0 100644 --- a/newlib/libc/stdlib/Makefile.am +++ b/newlib/libc/stdlib/Makefile.am @@ -208,43 +208,41 @@ lib_a_CFLAGS = $(AM_CFLAGS) lib_a_DEPENDENCIES = $(LIBADD_OBJS) $(ELIX_OBJS) LIB_COMPILE = $(AM_V_CC)$(COMPILE) -MALLOC_COMPILE = $(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 $@ $(lpfx)$(FREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_FREE -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(REALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(CALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(CFREER).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_CFREE -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(MALIGNR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MEMALIGN -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(VALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_VALLOC -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(PVALLOCR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/$(MALLOCR).c -o $@ $(lpfx)$(MALLINFOR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/$(MALLOCR).c -o $@ $(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 $@ $(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 $@ $(lpfx)$(MALLOPTR).o: $(MALLOCR).c - $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ + $(LIB_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/$(MALLOCR).c -o $@ $(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 13d014cc8e62..6167433c8e2c 100644 --- a/newlib/libc/stdlib/mallocr.c +++ b/newlib/libc/stdlib/mallocr.c @@ -209,7 +209,7 @@ int _dummy_mallocr = 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" { */ -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC #include @@ -345,7 +345,7 @@ extern void __malloc_unlock(); #define RCALL reent_ptr, #define RONECALL reent_ptr -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ #define POINTER_UINT unsigned long #define RARG @@ -355,7 +355,7 @@ extern void __malloc_unlock(); #define RCALL #define RONECALL -#endif /* ! INTERNAL_NEWLIB */ +#endif /* ! _LIBC */ /* Debugging: @@ -953,7 +953,7 @@ Void_t *(*__morecore)() = __default_morecore_init; #else /* INTERNAL_LINUX_C_LIB */ -#ifndef INTERNAL_NEWLIB +#ifndef _LIBC #if __STD_C extern Void_t* sbrk(ptrdiff_t); #else @@ -1000,7 +1000,7 @@ extern Void_t* sbrk(); #else -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC #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 -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ #define cALLOc calloc #define fREe free @@ -1038,7 +1038,7 @@ extern Void_t* sbrk(); #define mALLINFo mallinfo #define mALLOPt mallopt -#endif /* ! INTERNAL_NEWLIB */ +#endif /* ! _LIBC */ #endif /* Public routines */ @@ -3274,14 +3274,14 @@ Void_t* cALLOc(RARG n, elem_size) RDECL size_t n; size_t elem_size; */ #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; -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC _REENT_SMALL_CHECK_INIT(reent_ptr); fp = _stderr_r(reent_ptr); #define fprintf fiprintf diff --git a/newlib/libc/stdlib/nano-mallocr.c b/newlib/libc/stdlib/nano-mallocr.c index 0c5fb2885278..7ba1c0abc865 100644 --- a/newlib/libc/stdlib/nano-mallocr.c +++ b/newlib/libc/stdlib/nano-mallocr.c @@ -50,7 +50,7 @@ #define _SBRK_R(X) _sbrk_r(X) -#ifdef INTERNAL_NEWLIB +#ifdef _LIBC #include #include @@ -78,7 +78,7 @@ #define nano_mallinfo _mallinfo_r #define nano_mallopt _mallopt_r -#else /* ! INTERNAL_NEWLIB */ +#else /* ! _LIBC */ #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 */ /* Redefine names to avoid conflict with user names */ #define free_list __malloc_free_list -- 2.34.1