From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.gentoo.org (woodpecker.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) by sourceware.org (Postfix) with ESMTP id 343813858012 for ; Wed, 2 Mar 2022 01:36:31 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 343813858012 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 5EC23342D54; Wed, 2 Mar 2022 01:36:30 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 4/6] newlib: xstormy16: break up mallocr stubs Date: Tue, 1 Mar 2022 20:36:21 -0500 Message-Id: <20220302013623.368-5-vapier@gentoo.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220302013623.368-1-vapier@gentoo.org> References: <20220302013623.368-1-vapier@gentoo.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, 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: Wed, 02 Mar 2022 01:36:32 -0000 Move the multiplex logic out of the build and into source files to make the build rules a lot simpler. --- newlib/libc/machine/xstormy16/Makefile.am | 24 +++-------- newlib/libc/machine/xstormy16/Makefile.in | 52 ++++++++++++++--------- newlib/libc/machine/xstormy16/callocr.c | 7 +++ newlib/libc/machine/xstormy16/freer.c | 7 +++ newlib/libc/machine/xstormy16/mallocr.c | 26 ------------ newlib/libc/machine/xstormy16/reallocr.c | 7 +++ 6 files changed, 60 insertions(+), 63 deletions(-) create mode 100644 newlib/libc/machine/xstormy16/callocr.c create mode 100644 newlib/libc/machine/xstormy16/freer.c create mode 100644 newlib/libc/machine/xstormy16/reallocr.c diff --git a/newlib/libc/machine/xstormy16/Makefile.am b/newlib/libc/machine/xstormy16/Makefile.am index f5237dce3880..842bab9b04ff 100644 --- a/newlib/libc/machine/xstormy16/Makefile.am +++ b/newlib/libc/machine/xstormy16/Makefile.am @@ -7,7 +7,11 @@ AM_CCASFLAGS = $(AM_CPPFLAGS) noinst_LIBRARIES = lib.a lib_a_SOURCES = setjmp.S \ - mstats.c + callocr.c \ + freer.c \ + mallocr.c \ + mstats.c \ + reallocr.c lib_a_CFLAGS = $(AM_CFLAGS) lib_a_LIBADD = $(lpfx)malloc.o \ @@ -18,11 +22,7 @@ lib_a_LIBADD = $(lpfx)malloc.o \ $(lpfx)malign.o \ $(lpfx)valloc.o \ $(lpfx)pvalloc.o \ - $(lpfx)msize.o \ - $(lpfx)mallocr.o \ - $(lpfx)freer.o \ - $(lpfx)reallocr.o \ - $(lpfx)callocr.o + $(lpfx)msize.o lib_a_DEPENDENCIES = $(lib_a_LIBADD) @@ -54,15 +54,3 @@ $(lpfx)pvalloc.o: tiny-malloc.c $(lpfx)msize.o: tiny-malloc.c $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/tiny-malloc.c -o $@ - -$(lpfx)mallocr.o: mallocr.c - $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/mallocr.c -o $@ - -$(lpfx)freer.o: mallocr.c - $(MALLOC_COMPILE) -DDEFINE_FREE -c $(srcdir)/mallocr.c -o $@ - -$(lpfx)reallocr.o: mallocr.c - $(MALLOC_COMPILE) -DDEFINE_REALLOC -c $(srcdir)/mallocr.c -o $@ - -$(lpfx)callocr.o: mallocr.c - $(MALLOC_COMPILE) -DDEFINE_CALLOC -c $(srcdir)/mallocr.c -o $@ diff --git a/newlib/libc/machine/xstormy16/callocr.c b/newlib/libc/machine/xstormy16/callocr.c new file mode 100644 index 000000000000..3e5053c67650 --- /dev/null +++ b/newlib/libc/machine/xstormy16/callocr.c @@ -0,0 +1,7 @@ +#include + +void * +_calloc_r (struct _reent *r, size_t a, size_t b) +{ + return calloc (a, b); +} diff --git a/newlib/libc/machine/xstormy16/freer.c b/newlib/libc/machine/xstormy16/freer.c new file mode 100644 index 000000000000..f79ef55495af --- /dev/null +++ b/newlib/libc/machine/xstormy16/freer.c @@ -0,0 +1,7 @@ +#include + +void +_free_r (struct _reent *r, void *x) +{ + free (x); +} diff --git a/newlib/libc/machine/xstormy16/mallocr.c b/newlib/libc/machine/xstormy16/mallocr.c index 07be5303979d..d54df0bdf115 100644 --- a/newlib/libc/machine/xstormy16/mallocr.c +++ b/newlib/libc/machine/xstormy16/mallocr.c @@ -1,33 +1,7 @@ #include -#ifdef DEFINE_MALLOC void * _malloc_r (struct _reent *r, size_t sz) { return malloc (sz); } -#endif - -#ifdef DEFINE_CALLOC -void * -_calloc_r (struct _reent *r, size_t a, size_t b) -{ - return calloc (a, b); -} -#endif - -#ifdef DEFINE_FREE -void -_free_r (struct _reent *r, void *x) -{ - free (x); -} -#endif - -#ifdef DEFINE_REALLOC -void * -_realloc_r (struct _reent *r, void *x, size_t sz) -{ - return realloc (x, sz); -} -#endif diff --git a/newlib/libc/machine/xstormy16/reallocr.c b/newlib/libc/machine/xstormy16/reallocr.c new file mode 100644 index 000000000000..2bf538557b06 --- /dev/null +++ b/newlib/libc/machine/xstormy16/reallocr.c @@ -0,0 +1,7 @@ +#include + +void * +_realloc_r (struct _reent *r, void *x, size_t sz) +{ + return realloc (x, sz); +} -- 2.34.1