|Skip Navigation Links|
|Exit Print View|
|man pages section 1: User Commands Oracle Solaris 11.1 Information Library|
- manipulate the comment section of an object file
mcs [-cdHpVz] [-A file] [-a string][-n name] file...
The mcs command is used to display, compress, or append content to comment sections in an ELF object file. It can also be used to delete comment or non-comment sections, and to zero SHT_PROGBITS sections. Unless otherwise specified, the section named .comment is manipulated. mcs cannot modify or delete a section that is contained within a segment.
If the input file is an archive (see ar.h(3HEAD)), 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 must be given one or more of the options described below. It applies each option, in the order given, to each file.
For append operations, if the object does not already contain a section with the specified name, mcs will create a new empty section with that name before performing the append operation.
The following options are supported:
Appends the contents of the given file to the comment section of the object files.
Appends string to the comment section of the object files.
Compresses the contents of the comment section of the object files. All duplicate entries are removed. The ordering of the remaining entries is not disturbed.
Deletes the specified section from the object files.
When -p is used, suppress the output of the name of the file, as well as any blank lines normally inserted between the output for each file.
Specifies the name of the section to access if other than .comment. By default, mcs deals with the section named .comment. mcs can take multiple -n options to allow for specification of multiple sections. mcs always manipulations sections assuming that they have the format of a comment section.
Prints the contents of the comment section on the standard output. Unless used with -H, each section printed is prefixed with the name of the file from which it was extracted, using the format file[member_name]: for archive files and file: for other files.
Prints a message on standard error giving information about the version of mcs.
Replaces any SHT_PROGBITS sections with zeros while retaining the original attributes of the sections.
Example 1 Printing a file's comment section
The following entry
example% mcs -p elf.file
prints the comment section of the file elf.file.
Example 2 Appending a string to a comment section
The following entry
example% mcs -a xyz elf.file
appends string xyz to elf.file's comment section.
Example 3 Stripping a specified non-allocable section
Although used primarily with comment sections, mcs can operate on any non-allocable section. In contrast to the strip command, which removes a predefined selection of non-allocable sections, mcs can be used to delete a specific section. The following entry
example% mcs -d -n .annotate elf.file
removes the section named .annotate from the file elf.file.
See attributes(5) for descriptions of the following attributes:
When mcs deletes a section using the -d option, it tries to bind together sections of type SHT_REL and target sections pointed to by the sh_info section header field. If one is to be deleted, mcs attempts to delete the other of the pair.
The -z option removes the contents of SHT_PROGBITS sections while retaining the original ELF structure of the object. The need for use of the -z option is limited. However, the option can be used to deliver an object file when the contents of SHT_PROGBITS sections are not relevant.