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 D12DE385801A for ; Wed, 2 Mar 2022 01:36:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org D12DE385801A 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 23646342D37; Wed, 2 Mar 2022 01:36:28 +0000 (UTC) From: Mike Frysinger To: newlib@sourceware.org Subject: [PATCH 3/6] newlib: xstormy16: fix mallopt definition & mstats handling Date: Tue, 1 Mar 2022 20:36:20 -0500 Message-Id: <20220302013623.368-4-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.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: Wed, 02 Mar 2022 01:36:30 -0000 The mallopt symbol is defined in tiny-malloc.c, not mallocr.c, but the Makefile in here tries to compile it out of the latter. This leads to mallopt never being defined. The build also creates mallinfo.o & mallopt.o & mallstats.o objects to override common ones, but the common dir doesn't use these names. Instead, it places these all in mstats.o. So move the build define logic to a dedicated file and compile it directly to make things a bit simpler while fixing the missing func and aligning objects with the cmomon code. --- newlib/libc/machine/xstormy16/Makefile.am | 15 ++-------- newlib/libc/machine/xstormy16/Makefile.in | 36 +++++++++++++---------- newlib/libc/machine/xstormy16/mstats.c | 6 ++++ 3 files changed, 29 insertions(+), 28 deletions(-) create mode 100644 newlib/libc/machine/xstormy16/mstats.c diff --git a/newlib/libc/machine/xstormy16/Makefile.am b/newlib/libc/machine/xstormy16/Makefile.am index faaac89413ed..f5237dce3880 100644 --- a/newlib/libc/machine/xstormy16/Makefile.am +++ b/newlib/libc/machine/xstormy16/Makefile.am @@ -6,7 +6,8 @@ AM_CCASFLAGS = $(AM_CPPFLAGS) noinst_LIBRARIES = lib.a -lib_a_SOURCES = setjmp.S +lib_a_SOURCES = setjmp.S \ + mstats.c lib_a_CFLAGS = $(AM_CFLAGS) lib_a_LIBADD = $(lpfx)malloc.o \ @@ -17,10 +18,7 @@ lib_a_LIBADD = $(lpfx)malloc.o \ $(lpfx)malign.o \ $(lpfx)valloc.o \ $(lpfx)pvalloc.o \ - $(lpfx)mallinfo.o \ - $(lpfx)mallstats.o \ $(lpfx)msize.o \ - $(lpfx)mallopt.o \ $(lpfx)mallocr.o \ $(lpfx)freer.o \ $(lpfx)reallocr.o \ @@ -54,18 +52,9 @@ $(lpfx)valloc.o: tiny-malloc.c $(lpfx)pvalloc.o: tiny-malloc.c $(MALLOC_COMPILE) -DDEFINE_PVALLOC -c $(srcdir)/tiny-malloc.c -o $@ -$(lpfx)mallinfo.o: tiny-malloc.c - $(MALLOC_COMPILE) -DDEFINE_MALLINFO -c $(srcdir)/tiny-malloc.c -o $@ - -$(lpfx)mallstats.o: tiny-malloc.c - $(MALLOC_COMPILE) -DDEFINE_MALLOC_STATS -c $(srcdir)/tiny-malloc.c -o $@ - $(lpfx)msize.o: tiny-malloc.c $(MALLOC_COMPILE) -DDEFINE_MALLOC_USABLE_SIZE -c $(srcdir)/tiny-malloc.c -o $@ -$(lpfx)mallopt.o: mallocr.c - $(MALLOC_COMPILE) -DDEFINE_MALLOPT -c $(srcdir)/mallocr.c -o $@ - $(lpfx)mallocr.o: mallocr.c $(MALLOC_COMPILE) -DDEFINE_MALLOC -c $(srcdir)/mallocr.c -o $@ diff --git a/newlib/libc/machine/xstormy16/mstats.c b/newlib/libc/machine/xstormy16/mstats.c new file mode 100644 index 000000000000..1bd24da555f1 --- /dev/null +++ b/newlib/libc/machine/xstormy16/mstats.c @@ -0,0 +1,6 @@ +/* stdlib/mstats.c defines all these symbols in this file. + TODO: Missing mstats function. */ +#define DEFINE_MALLINFO +#define DEFINE_MALLOC_STATS +#define DEFINE_MALLOPT +#include "tiny-malloc.c" -- 2.34.1