Tip Concerning Massive COFF Comment Sections

Nick Crossley ndjc at hobbit.UUCP
Tue Jun 5 06:08:56 AEST 1990

In article <1990Jun1.134459.4296 at pcrat.uucp> rick at pcrat.uucp
(Rick_Richardson) writes much about COFF .comment sections, and
how to reduce their size.

I don't think this is particularly relevant to this newsgroup, as
.comment sections are nothing to do with C, but are part of both
the COFF and ELF (V.4) object formats (perhaps further discussion
should be in comp.unix.questions?).

However, he did miss out perhaps the most important and simple way
to limit the size of .comment sections; use of mcs -c.  Rather than
just delete the comment sections (which the software developers
and OS suppliers might make good use of for support), just insure
that each comment is included only once.  If a header file contains
a #ident, that string will appear in the binary as many times as
that header file was included (plus or minus a few depending on
whether or not the header was included in the same source more than
once and whether or not the #ident was inside or outside any #ifndef
__XXX_H_ ... #endif stuff).  For common header files such as
<stdio.h>, this can mean the same strings will appear many times
in a fully linked binary.

Use of mcs -c will condense the .comment section so that each unique
string appears only once.  Makefiles intended for systems with
.comment sections (such as V.3 and V.4) should have mcs -c <binary>
added after final linking.

<<< standard disclaimers >>>
Nick Crossley, ICL NA, 9801 Muirlands, Irvine, CA 92718-2521, USA 714-458-7282
uunet!ccicpg!ndjc  /  ndjc at ccicpg.UUCP

More information about the Comp.unix.i386 mailing list