Re: [PATCH 3/6] newlib: xstormy16: fix mallopt definition & mstats handling

Mike Frysinger <[email protected]>
Newsgroups gmane.comp.lib.newlib
Message-ID <YihyIWDSvcjzDDO+@vapier>
On 02 Mar 2022 10:46, Corinna Vinschen wrote:
> On Mar  1 20:36, Mike Frysinger wrote:
> > 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/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"
> 
> XStormy16 is such a small target, it would be better to split these into
> three files.

it must be really tiny if we need to micro manage this.
    152       0       0     152      98 lib_a-mallinfo.o
    274       0       0     274     112 lib_a-mallstats.o
      4       0       0       4       4 lib_a-mallopt.o

the only way they'd get pulled in is if one func is used, so if code called
mallopt() but not mallinfo() or malloc_stats(), it would waste 426 bytes.

the point of this change is to align xstormy16 with how common code is laid
out.  are you suggesting we split the common mstats.c too ?  it wouldn't be
hard as that file is pretty small.
-mike
signature.asc (application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEuQK1JxMl+JKsJRrUQWM7n+g39YEFAmIociEACgkQQWM7n+g3
9YH3SQ//YVT/wdOmOmJF1lyMDI1mDySQtvUYfJ+LomNc+voRsazcuiNIF8DsFu3Q
DVzehFEvkHl+arRKNtzsBFz+9IIVRhB3Fw9moK+2UX14P/nE6XaQ+46ZykDigqb1
w4aVEGMhMEY24ztmWXkrwmOvs1c1YgLFO53Xty+tMoh//wo77O+2wHWTsszyHijr
vP4V0FixI5yJ3AYy1eAEB6svguYJmtd6ANBx+0pt5R/eMWIHNnP334tI27u5S3NE
RaKJWXLHbm3bcwsTOSdL6GU6sfCJzKgHDBvcHgxYla/Fr+gIeGkdlu9Jh/FyXzdu
T5ruQjcB5gBKS9c8ai6saXVC+IUEL3WtMC4/mbGoRZOcARmVQAYVX0n268D8B7Jk
YAU0wbkyYMIEZ25OUH4Pfp2wEoyK3+GJRsBB//KqM/QvBpodQfPQiuROIrcDegDi
h3QW3EbI0Id5KUS9r5FKpaQWMrCxWEfnJthW5/EYv6V5hAGbN1A5eM3jF5FEzn9d
sjr57h04j9nTMYHvbZGrsaGHs7jtXD3HJTkZ05TzwPnzFTbO0uJ73X6+FWCbsgcg
yO5FNKBzrduK8iEIygfZTBIukjYbmdlNQuyj62VtNqbeDgkSSduHdirEBxjdw86j
PUWsJ5d1H4covxGkl/wATUVpqFK34RatP9Czyujnv+4xcU6ryS0=
=gTrt
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.