undefined references since newlib-3.2.0
Keith Packard
keithp@keithp.com
Sat Jun 13 00:05:15 GMT 2020
Josef Wolf <jw@raven.inka.de> writes:
> This patch replaces Balloc() by eBalloc() which calls __assert_func() on
> failure which in turn calls exit() and/or abort()
As an interim step, having a fix available sooner was a good thing.
> Shouldn't those library functions simply report the error by returning NULL to
> the caller and let the application handle the situation?
It's complicated by the libc API which doesn't have defined error return
values for all of the affected APIs. Glibc has similar failure modes;
using those is probably the best option for newlib.
I've patched this code in picolibc (a newlib fork designed for embedded
systems) to track the malloc failures and return status information back
to applications. Interested parties might want to port those fixes back
to newlib.
https://github.com/keith-packard/picolibc/commit/dad1bd20fb927fb14a63d7951b0441f1cec73bf8
https://github.com/keith-packard/picolibc/commit/9fc3006ef9fec4a72b6dd29d2b691c1cc386e8f1
I've also implemented the recent 'ryu' float/string conversion code,
which performs exact (i.e. round-trip-able) conversions with much lower
precision (128bit for 64-bit floats, 64-bit for 32-bit floats). As a
result, that code does all of its operations on the stack and doesn't
use malloc at all, eliminating this particular source of errors. That
code was not writen for the newlib stdio bits, but instead for the
picolibc tinystdio bits. Still, it might serve as a basis for a newlib
port.
--
-keith
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 832 bytes
Desc: not available
URL: <https://sourceware.org/pipermail/newlib/attachments/20200612/bace570d/attachment.sig>
More information about the Newlib
mailing list