[PATCH] RFC: reduce static data usage

Bernhard Fischer rep.dot.nop at gmail.com
Mon Jul 23 21:29:24 UTC 2007


On Sat, Jul 21, 2007 at 04:25:18PM +0100, Denis Vlasenko wrote:
>Hi,
>
>[hopefully this mail is under ml size limit]
>
>These six patches make uclibc malloc big(ger) buffers instead of
>keeping them in data/bss - should help NOMMU people.
>
>patch #1: introduce __uc_malloc, so that users can intercept OOM.
>patch #2: convert des.c to use __uc_malloc (-70 kbytes of bss)
>patch #3: convert resolv.c
>patch #4: convert pwd_grp.c
>patch #5: convert utent.c, getpass.c
>patch #6: convert getnetent.c, md5.c
>
>This deals with almost all buffers bigger than 100 bytes.
>We pay in code size for that (+20 - +40 bytes per module
>on i386):

Sounds like a good idea to me, fwiw.
The '//' comments should be converted to '/**/' imo, but that's just
cosmetics. Also, i think that you should hide all stuff that is exported
in __uc_malloc.c (see hidden_proto/hidden_def et al).
Care to take this into account?

cheers,

>    text data   bss   dec   hex filename
>-    584    8   384   976   3d0 utent.o
>+    611    8     4   623   26f utent.o
>-     38    0   288   326   146 fgetgrent.o
>+     63    0     4    67    43 fgetgrent.o
>-     38    0   288   326   146 fgetpwent.o
>+     63    0     4    67    43 fgetpwent.o
>-     38    0   320   358   166 fgetspent.o
>+     63    0     4    67    43 fgetspent.o
>-     34    0   288   322   142 getgrent.o
>+     59    0     4    63    3f getgrent.o
>-     38    0   288   326   146 getgrgid.o
>+     63    0     4    67    43 getgrgid.o
>-     38    0   288   326   146 getgrnam.o
>+     63    0     4    67    43 getgrnam.o
>-     34    0   288   322   142 getpwent.o
>+     59    0     4    63    3f getpwent.o
>-     38    0   288   326   146 getpwnam.o
>+     63    0     4    67    43 getpwnam.o
>-     38    0   288   326   146 getpwuid.o
>+     63    0     4    67    43 getpwuid.o
>-     34    0   320   354   162 getspent.o
>+     59    0     4    63    3f getspent.o
>-     38    0   320   358   166 getspnam.o
>+     63    0     4    67    43 getspnam.o
>-     38    0   320   358   166 sgetspent.o
>+     40    0     4    44    2c sgetspent.o
>-    458    0   172   630   276 getnetent.o
>+    496    0     8   504   1f8 getnetent.o
>-     45    0   480   525   20d gethostbyname.o
>+     66    0     4    70    46 gethostbyname.o
>-     53    0   492   545   221 gethostbyaddr.o
>+     74    0     4    78    4e gethostbyaddr.o
>-     49    0   492   541   21d gethostbyname2.o
>+     70    0     4    74    4a gethostbyname2.o
>-    189    0   168   357   165 gethostent.o
>+    210    0    12   222    de gethostent.o
>-    314    0   256   570   23a getpass.o
>+    343    0     4   347   15b getpass.o
>-   4097    0 70240 74337 12261 des.o
>+   4391    0     8  4399  112f des.o
>-   1921    0   160  2081   821 md5.o
>+   1857    0     4  1861   745 md5.o



More information about the uClibc mailing list