Necessary code or trash?

Daniela dgw at liwest.at
Fri Sep 5 12:42:40 PDT 2003


On Monday 28 August 2028 17:52, Denis Troshin wrote:
> Hi!
>
> I have FreeBSD 5.0-RELEASE.
>
> Why most of bin (sbin) utilities are so big.
>
> For example,
>
>  rm   - 410 268 bytes,
>  mv   - 407 568 bytes,
>  date - 423 748 bytes.
>
> Do they really contain only necessary code or
> have more than a half of trash?
>
> If you think my question is very stupid to answer,
> please give a few links to read about this problem.

Did you compile debug symbols in?

If you want them smaller, you can link them dynamically:
Add -DNOSTATIC to the make command line. But be prepared: /sbin/init doesn't 
like this (unless /usr is on the same partition), because it needs to access 
the libraries.
Be sure to back up any binaries the system needs to access before /usr is 
mounted, and restore them right after installation. Check your boot floppy: 
If anything causes a reboot before the binaries are restored, your system 
would be UNBOOTABLE, and you'd be in real trouble.

Dynamic linking causes the binaries to load code from shared libraries.
Statically linked binaries have the library contents copied into themselves.
All the system binaries are statically linked, so there's a lot of duplicate 
code. However, static linking is a lot faster and more convenient.
If you need the space and are willing to accept the performance hit and aren't 
afraid of some extra work, then link them dynamically. But don't say I 
haven't warned you of the consequences!

I'm not an expert at this, if someone knows better, please correct me.

Regards,
Daniela




More information about the freebsd-questions mailing list