Unfortunate dynamic linking for everything
bde at zeta.org.au
Fri Nov 21 18:35:44 PST 2003
On Fri, 21 Nov 2003, Tim Kientzle wrote:
> Bruce Evans wrote:
> > It obviously uses NSS. How else could it be so bloated? :
> > $ ls -l /sbin/init
> > -r-x------ 1 root wheel 453348 Nov 18 10:30 /sbin/init
> I believe it's actually DNS, not NSS.
> Pre-5.0, the resolver ballooned significantly.
> A lot of the bloat in /bin and /sbin came
> from the NIS functions which in turn pull in
> the resolver.
> Example: /bin/date on 5.1 is also over 450k
> because of a single call to getservbyname().
> Removing that one call shrinks a static /bin/date
> to a quite reasonable size. (I seem to recall 80k when
> I did this experiment.)
The 2 calls to logwtmp() must also be removed, at least now.
I get the following text sizes: for /bin/date:
-current*: 93214 (* = getservbyname() and logwtmp() calls removed)
-current: 371226 (only 412492 total, not 450K yet)
> I note that /sbin/init calls getpwnam();
> I expect that's where the bloat gets pulled in.
Yes, except it's only the latest 200+K of bloat (from 413558 bytes text
to 633390). Before that there was 100+K of miscellaneous bloat
relative to RELENG_4 (text size 305289 there). Before that there was
another 200+K of bloat from implementing history. Compiling with
-DNO_HISTORY removes history support and reduces the text size to
162538 (this is without getpwnam()). Then there is another 30K of
mostly non-bloat for actual changes within /bin/sh, since compiling
the FreeBSD-1 /bin/sh with current libraries gives a text size of
132966. Finally, IIRC the text size of the FReeeBSD-1 /bin/sh is
70K (total size 90K), so there is another 60K of miscellaneous bloat
in current libraries to increase the text size from 70K to 130K.
Total text sizes for /bin/sh's internals:
FreeBSD-1 sh compiled with -current's compiler: 55350
current sh compiled with -current's compiler: 87779
87:55 is about right for the increased functionality.
More information about the freebsd-current