tkchia / newlib-ia16

Fork of IA-16 port of Newlib -- added small and medium model support
GNU General Public License v2.0
13 stars 4 forks source link

Enabling multi-byte character support (--enable-newlib-mb) causes a lot of bloat to be linked in #18

Open tkchia opened 2 years ago

tkchia commented 2 years ago

In particular, vsscanf (...) will use __locale_charset (), which is contained in the same C module as setlocale (.) and lots of other locale-related functions (!). There might also be other factors leading to the bloat.

In any case, the result is that — unfortunately — one cannot write an MS-DOS tiny model program that uses vsscanf (...), because the code and data rapidly exceed 64 KiB (!).

tkchia commented 2 years ago

Mostly (but not completely) solved, by making gcc-ia16 + newlib-ia16 auto-detect whether it should link in floating-point support into the output program (https://github.com/tkchia/gcc-ia16/commit/8fbff4a9e85f6705b04c3121797c2d8bb8104957; also a bug fix at https://github.com/tkchia/newlib-ia16/commit/dd7b82a148dff8241477758cfedd518f33b99569).

The floating-point support weighs in at about 40 KiB and is responsible for most of the bloat. setlocale (.) and friends do also take up quite a fair bit of space, though.