Memory usage of __global_locale for non-locale functions
Hans-Bernhard Bröker
HBBroeker@t-online.de
Fri May 26 17:52:00 GMT 2017
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.
More information about the Newlib
mailing list