public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
* [newlib-cygwin] newlib: xstormy16: fix mallopt definition & mstats handling
@ 2022-03-13 21:15 Michael Frysinger
  0 siblings, 0 replies; only message in thread
From: Michael Frysinger @ 2022-03-13 21:15 UTC (permalink / raw)
  To: newlib-cvs

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5cd957ff66a9bbd5532a2b00f31e9aace99bdf3a

commit 5cd957ff66a9bbd5532a2b00f31e9aace99bdf3a
Author: Mike Frysinger <vapier@gentoo.org>
Date:   Tue Mar 1 00:58:55 2022 -0500

    newlib: xstormy16: fix mallopt definition & mstats handling
    
    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.

Diff:
---
 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(-)

diff --git a/newlib/libc/machine/xstormy16/Makefile.am b/newlib/libc/machine/xstormy16/Makefile.am
index faaac8941..f5237dce3 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/Makefile.in b/newlib/libc/machine/xstormy16/Makefile.in
index 5a63ea2e4..eeaec12f3 100644
--- a/newlib/libc/machine/xstormy16/Makefile.in
+++ b/newlib/libc/machine/xstormy16/Makefile.in
@@ -117,7 +117,7 @@ am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
 am__v_AR_0 = @echo "  AR      " $@;
 am__v_AR_1 = 
 lib_a_AR = $(AR) $(ARFLAGS)
-am_lib_a_OBJECTS = setjmp.$(OBJEXT)
+am_lib_a_OBJECTS = setjmp.$(OBJEXT) lib_a-mstats.$(OBJEXT)
 lib_a_OBJECTS = $(am_lib_a_OBJECTS)
 AM_V_P = $(am__v_P_@AM_V@)
 am__v_P_ = $(am__v_P_@AM_DEFAULT_V@)
@@ -140,6 +140,10 @@ AM_V_CPPAS = $(am__v_CPPAS_@AM_V@)
 am__v_CPPAS_ = $(am__v_CPPAS_@AM_DEFAULT_V@)
 am__v_CPPAS_0 = @echo "  CPPAS   " $@;
 am__v_CPPAS_1 = 
+AM_V_lt = $(am__v_lt_@AM_V@)
+am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
+am__v_lt_0 = --silent
+am__v_lt_1 = 
 COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
 	$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
 AM_V_CC = $(am__v_CC_@AM_V@)
@@ -309,7 +313,9 @@ top_srcdir = @top_srcdir@
 AM_CPPFLAGS = $(NEWLIB_CFLAGS) $(TARGET_CFLAGS)
 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 \
 	$(lpfx)free.o \
@@ -319,10 +325,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 \
@@ -333,7 +336,7 @@ MALLOC_COMPILE = $(COMPILE)
 all: all-am
 
 .SUFFIXES:
-.SUFFIXES: .S .o .obj
+.SUFFIXES: .S .c .o .obj
 $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
 	@for dep in $?; do \
 	  case '$(am__configure_deps)' in \
@@ -384,6 +387,18 @@ distclean-compile:
 .S.obj:
 	$(AM_V_CPPAS)$(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
 
+.c.o:
+	$(AM_V_CC)$(COMPILE) -c -o $@ $<
+
+.c.obj:
+	$(AM_V_CC)$(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
+
+lib_a-mstats.o: mstats.c
+	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mstats.o `test -f 'mstats.c' || echo '$(srcdir)/'`mstats.c
+
+lib_a-mstats.obj: mstats.c
+	$(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(lib_a_CFLAGS) $(CFLAGS) -c -o lib_a-mstats.obj `if test -f 'mstats.c'; then $(CYGPATH_W) 'mstats.c'; else $(CYGPATH_W) '$(srcdir)/mstats.c'; fi`
+
 ID: $(am__tagged_files)
 	$(am__define_uniq_tagged_files); mkid -fID $$unique
 tags: tags-am
@@ -578,18 +593,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 000000000..1bd24da55
--- /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"


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-13 21:15 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-13 21:15 [newlib-cygwin] newlib: xstormy16: fix mallopt definition & mstats handling Michael Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).