[comp.unix.sysv386] Strings in Standard Library

todd@toolz.uucp (Todd Merriman) (03/28/91)

I noticed that the last release of the Unix development software
 from Interactive included object libraries with many strings
imbedded in each object module indicating which header was
included during compilation. 

This useless information adds a huge amount of size to
executables. It would be wonderful if the linker could exclude
this information, but it can't.  Is it too much to ask of
Interactive to just leave all that static data out? 

* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Todd Merriman - Software Toolz, Inc.              * Maintainer of the *
* 8030 Pooles Mill Dr., Ball Ground, GA 30107-9610  * Software          *
* ...emory.edu!toolz.uucp!todd                      * Entrepreneur's    *
* V-mail (800) 869-3878, (404) 889-8264             * mailing list      *
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

tmh@prosun.first.gmd.de (Thomas Hoberg) (03/29/91)

In article <1991Mar28.033357.1439@toolz.uucp>, todd@toolz.uucp (Todd Merriman) writes:
|> I noticed that the last release of the Unix development software
|>  from Interactive included object libraries with many strings
|> imbedded in each object module indicating which header was
|> included during compilation. 
|> 
|> This useless information adds a huge amount of size to
|> executables. It would be wonderful if the linker could exclude
|> this information, but it can't.  Is it too much to ask of
|> Interactive to just leave all that static data out? 
|> 
|> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|> * Todd Merriman - Software Toolz, Inc.              * Maintainer of the *
|> * 8030 Pooles Mill Dr., Ball Ground, GA 30107-9610  * Software          *
|> * ...emory.edu!toolz.uucp!todd                      * Entrepreneur's    *
|> * V-mail (800) 869-3878, (404) 889-8264             * mailing list      *
|> * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Lookup the 'mcs' command (manage comment structures?). 'mcs -d' will delete
the comment strings, 'mcs -c' will remove duplicates, 'mcs -p' will print them
and there was something else I'd have to look up, too.
While I haven't used that information myself, somebody must have thought these
worthwhile.
I keep promising myself that once I'll read those manuals from cover to cover...

-- tom
----
Thomas M. Hoberg   | UUCP: tmh@bigfoot.first.gmd.de  or  tmh%gmdtub@tub.UUCP
c/o GMD Berlin     |       ...!unido!tub!gmdtub!tmh (Europe) or
D-1000 Berlin 12   |       ...!unido!tub!tmh
Hardenbergplatz 2  |       ...!pyramid!tub!tmh (World)
Germany            | BITNET: tmh%DB0TUI6.BITNET@DB0TUI11 or
+49-30-254 99 160  |         tmh@tub.BITNET

cpcahil@virtech.uucp (Conor P. Cahill) (03/29/91)

todd@toolz.uucp (Todd Merriman) writes:

>I noticed that the last release of the Unix development software
> from Interactive included object libraries with many strings
>imbedded in each object module indicating which header was
>included during compilation. 
>This useless information adds a huge amount of size to
>executables. It would be wonderful if the linker could exclude
>this information, but it can't.  Is it too much to ask of
>Interactive to just leave all that static data out? 

Read the man page for MCS(1) in the programmers reference manual.

-- 
Conor P. Cahill            (703)430-9247        Virtual Technologies, Inc.
uunet!virtech!cpcahil                           46030 Manekin Plaza, Suite 160
                                                Sterling, VA 22170 

det@hawkmoon.MN.ORG (Derek E. Terveer) (03/31/91)

In article <1991Mar28.033357.1439@toolz.uucp>, todd@toolz.uucp (Todd Merriman) writes:
|> I noticed that the last release of the Unix development software
|>  from Interactive included object libraries with many strings [...]
|> Is it too much to ask of Interactive to just leave all that static data out? 

But how much extra data is really loaded?  Are those comments really loaded?  If
they are strings embedded in the code, i suppose that they would be.  But doing
a "mcs -p /lib/lib*a /usr/lib/lib*a|wc" revealed a total of 450K of strings in
all of the /lib and /usr/lib libraries, total.  Certainly only a fraction of those
libraries are loaded into any application, so maybe we are only talking a few 10s of
K here...

derek
-- 
Derek "Tigger" Terveer	det@hawkmoon.MN.ORG -- U of MN Women's Lax
I am the way and the truth and the light, I know all the answers; don't need
your advice.  -- "I am the way and the truth and the light" -- The Legendary Pink Dots

kherron@ms.uky.edu (Kenneth Herron) (03/31/91)

det@hawkmoon.MN.ORG (Derek E. Terveer) writes:

>In article <1991Mar28.033357.1439@toolz.uucp>, todd@toolz.uucp (Todd Merriman) writes:
>|> I noticed that the last release of the Unix development software
>|>  from Interactive included object libraries with many strings [...]
>|> Is it too much to ask of Interactive to just leave all that static data out? 

>But how much extra data is really loaded?...doing  a  "mcs  -p  
>/lib/lib*a /usr/lib/lib*a|wc" revealed a total of 450K of strings 
>in all of the /lib and /usr/lib libraries, total.

Actually, it's worse than that: Every time the compiler compiles
a source file which includes standard header files, the comment
line from each include file is included in the resulting object
file.  When all the object files are linked, every comment line
is preserved, including the ones from the libraries. So if your
source code is in ten separate .c files, and they each include
stdio.h, then you'll get ten or more copies of the comment line
from stdio.h.

These lines all end up in the comment section; the size command
will show you how large this section is. Mcs can either remove
the entire comment section or just the duplicate lines.

These comment lines are *not* loaded into memory at runtime; they
only take up disk space.




























































-- 
Kenneth Herron                                            kherron@ms.uky.edu
University of Kentucky                                        (606) 257-2975
Department of Mathematics 
                                "Never trust gimmicky gadgets" -- the Doctor