This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: Memory usage of __global_locale for non-locale functions
- From: Hans-Bernhard Bröker <HBBroeker at t-online dot de>
- To: Prakhar Bahuguna <prakhar dot bahuguna at arm dot com>, newlib at sourceware dot org
- Cc: nd at arm dot com
- Date: Fri, 26 May 2017 19:52:10 +0200
- Subject: Re: Memory usage of __global_locale for non-locale functions
- Authentication-results: sourceware.org; auth=none
- References: <20170526133112.mh6nbz2bvn6t2fp5@e107464-lin.cambridge.arm.com>
Am 26.05.2017 um 15:31 schrieb Prakhar Bahuguna:
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().
Your classification of stroul() as a non-locale function is wrong.
This general issue has come up before, quite recently:
https://sourceware.org/ml/newlib/2017/msg00192.html
The answer for you is the same as it was then: a library that does
support setlocale at all has little chance but to pull in the required
machinery as soon as any of the localized standard library functions (or
macros) is referred to by the program.
And no, I don't think there's a configure-time option to disable locale
altogether.