This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Memory usage of __global_locale for non-locale functions
- From: Prakhar Bahuguna <prakhar dot bahuguna at arm dot com>
- To: <newlib at sourceware dot org>
- Cc: <nd at arm dot com>
- Date: Fri, 26 May 2017 14:31:13 +0100
- Subject: Memory usage of __global_locale for non-locale functions
- Authentication-results: sourceware.org; auth=none
- Authentication-results: sourceware.org; dkim=none (message not signed) header.d=none;sourceware.org; dmarc=none action=none header.from=arm.com;
- Nodisclaimer: True
- Spamdiagnosticmetadata: NSPM
- Spamdiagnosticoutput: 1:99
Hello,
We've noticed that since a series of patches to add support for POSIX-1.2008
per-thread locales in August 2015, the size of the .data section in binaries
produced by our toolchain has increased significantly due to the
__global_locale struct in lib_a-locale.o. This is linked in when any strto*()
function is called. This is true even for non-locale functions such as
strtoul(). Inspection of the code shows that these have been deliberately
re-architected as simple wrappers around the equivalent strto*_l(), passing in
the global C locale as the locale parameter.
As we wish to minimise code size and particularly RAM usage for microcontroller
targets which do not usually require anything beyond the C locale, would it be
possible to define a configure option that avoids linking in __global_locale,
in a manner that would not require significant engineering effort?
Alternatively, would there be a way to minimise the footprint of the
__global_locale struct for this application?
Thanks,
--
Prakhar Bahuguna