mcs -- manipulate the comment section of an object file


mcs [-b format ] [-a string] [-c] [-d] [-n name] [-p] [-V] file . . .


The mcs command is used to manipulate a section, by default the .comment section, in an object file. mcs must be given one or more of the options described below. It takes each of the options given and applies them in order to each file.

If the input file is an archive (see ar(FP)), the archive is treated as a set of individual files. For example, if the -a option is specified, the string is appended to the comment section of each object file in the archive; if the archive member is not an object file, then it is left unchanged.

mcs can manipulate both ELF and COFF files. mcs scans each input file to determine its file format and executes the appropriate binary. The file format of the first module in an archive library is used as the file format for all modules in that library. Use option -b to force mcs to use a particular file format.

The following options are available.

-b format
Do not scan input object files. Use format as the file format for all files. format can be any one of elf, coff and ibcs2. The case of format is not important.

-b coff
Invoke /usr/ccs/bin/coff/mcs and treat all file arguments as COFF files. This option provides full backward compatibility.

CAUTION: mcs fails if any file or module in a file is in ELF format.

-b elf
Invoke /usr/ccs/bin/elf/mcs and treat all file arguments as ELF files. Add to, delete, print, and compress the contents of a section in an ELF object file, and only print the contents of a section in a COFF object file.

-b ibcs2
Invoke /usr/ccs/bin/coff/mcs to treat all file arguments as COFF files.

-a string
Append string to the comment section of the object files. If string contains embedded blanks, it must be enclosed in quotation marks.

Compress the contents of the comment section of the object files. All duplicate entries are removed. The ordering of the remaining entries is not disturbed.

Delete the contents of the comment section from the object files. The section header for the comment section is also removed.

-n name
Specify the name of the comment section to access if other than .comment. By default, mcs deals with the section named .comment. This option can be used to specify another section.

Print the contents of the comment section on the standard output. Each section printed is tagged by the name of the file from which it was extracted, using the format filename[member_name]: for archive files and filename: for other files.

Print, on standard error, the version number of mcs.
If mcs is executed on an archive file the archive symbol table will be removed, unless only the -p option has been specified. The archive symbol table must be restored by executing the ar command with the -s option before the archive can be linked by the ld(CP) command. mcs will produce warning messages when this situation arises.

International functions

Characters from supplementary code sets can be used in files. Comments using characters from supplementary code sets can be specified with the -a option.


mcs -p file
Print file's comment section

mcs -a string file
Append string to file's comment section


mcs cannot add to, delete, or compress the contents of a section that is contained in a segment.

The section name specified in name with the -n option must contain ASCII characters only.


temporary files

usually /var/tmp but can be redefined by setting the environment variable TMPDIR (see tempnam(S) in tmpnam(S)).

See also

a.out(FP), ar(CP), ar(FP), as(CP), cc(CP), ld(CP), tmpnam(S)

Standards conformance

mcs is not part of any currently supported standard; it is an extension of AT&T System V provided by The Santa Cruz Operation, Inc.
© 2003 Caldera International, Inc. All rights reserved.
SCO OpenServer Release 5.0.7 -- 11 February 2003