[PATCH newlib]New configuration option disable io vector buffer in Newlib

Bin Cheng bin.cheng@arm.com
Tue Mar 26 10:14:00 GMT 2013


Hi,
Stream IO functions in Newlib construct structures like __suio/__siov, then
call function __sfvwrite_r to do the buffered IO. From the view of MCU
programs, this layer code of vector buffer occupies large amount flash and
is generally unnecessary. So here this patch introduces a new configuration
time option "--disable-newlib-fvwrite-in-streamio" allowing user to disable
io vector buffer in Newlib, thus reduces foot-print of stream-io and
formatted IO.
The default behavior won't be changed unless the option "--disbale-*" is
specified explicitly when configuring.
I tested it with some formatted IO tests and also passed the gcc regression
test. It has also been applied in the release of "GNU Tools for ARM Embedded
Processors" and used in many projects I believe.

Is it OK or any suggestions?

Thanks very much.

2013-03-26  Bin Cheng  <bin.cheng@arm.com>
	* acconfig.h (_FVWRITE_IN_STREAMIO): Undef
	* newlib.hin (_FVWRITE_IN_STREAMIO): Undef
	* configure.in (--disable-newlib-fvwrite-in-streamio): New option.
	* configure: Regenerated.
	* libc/stdio/fputs.c (_fputs_r): Use _FSEEK_OPTIMIZATION to
	control __sfvwrite_r.  Add alternative implementation.
	* libc/stdio/fputws.c (_fputws_r): Ditto.
	* libc/stdio/fwrite.c (_fwrite_r): Ditto.
	* libc/stdio/puts.c (_puts_r): Ditto.
	* libc/stdio/vfprintf.c (__ssputs_r, __sfputs_r): New function.
	(_VFPRINTF_R): Use _FSEEK_OPTIMIZATION to control vector buffer.
	(__SPRINT): Use _FSEEK_OPTIMIZATION to control macro definition.
	* libc/stdio/vfwprintf.c (_VFWPRINTF_R): Use _FSEEK_OPTIMIZATION to
	control vector buffer.
	(__SPRINT): Use _FSEEK_OPTIMIZATION to control macro definition.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: streamio-iov-20130326.txt
URL: <http://sourceware.org/pipermail/newlib/attachments/20130326/2b542975/attachment.txt>


More information about the Newlib mailing list