2 .\" Copyright 1989 AT&T
3 .\" Copyright (c) 2007, Sun Microsystems, Inc. All Rights Reserved.
4 .\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License"). You may not use this file except in compliance with the License.
5 .\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing. See the License for the specific language governing permissions and limitations under the License.
6 .\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE. If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
7 .TH MCS 1 "Oct 5, 2007"
9 mcs \- manipulate the comment section of an object file
13 \fBmcs\fR [\fB-cdpVz\fR] [\fB-a\fR \fIstring\fR] [\fB-n\fR \fIname\fR] \fIfile\fR...
19 The \fBmcs\fR command is used to manipulate a section, by default the
20 \fB\&.comment\fR section, in an \fBELF\fR object file. It is used to add to,
21 delete, print, and compress the contents of a section in an \fBELF\fR object
22 file, and print only the contents of a section in a \fBCOFF\fR object file.
23 \fBmcs\fR cannot add, delete, or compress the contents of a section that is
24 contained within a segment.
27 If the input file is an archive (see \fBar.h\fR(3HEAD)), the archive is treated
28 as a set of individual files. For example, if the \fB-a\fR option is specified,
29 the string is appended to the comment section of each \fBELF\fR object file in
30 the archive; if the archive member is not an \fBELF\fR object file, then it is
34 \fBmcs\fR must be given one or more of the options described below. It applies,
35 in order, each of the specified options to each file.
38 For operations other than delete, if the object does not already contain a
39 section with the specified name, \fBmcs\fR will create a new empty section with
40 that name before performing the specified operation.
44 The following options are supported:
48 \fB\fB-a\fR \fIstring\fR\fR
51 Appends \fIstring\fR to the comment section of the \fBELF\fR object files. If
52 \fIstring\fR contains embedded blanks, it must be enclosed in quotation marks.
61 Compresses the contents of the comment section of the \fBELF\fR object files.
62 All duplicate entries are removed. The ordering of the remaining entries is not
72 Deletes the contents of the specified section from the \fBELF\fR object files.
73 The section header for the comment section is also removed.
79 \fB\fB-n\fR \fIname\fR\fR
82 Specifies the name of the section to access if other than \fB\&.comment\fR. By
83 default, \fBmcs\fR deals with the section named \fB\&.comment\fR. This option
84 can be used to specify another section. \fBmcs\fR can take multiple \fB-n\fR
85 options to allow for specification of multiple sections.
94 Prints the contents of the comment section on the standard output. Each section
95 printed is tagged by the name of the file from which it was extracted, using
96 the format \fIfile\fR\fB[\fR\fImember_name\fR\fB]:\fR for archive files and
97 \fIfile\fR\fB:\fR for other files.
106 Prints on standard error the version number of \fBmcs\fR.
115 Replaces any \fBSHT_PROGBITS\fR sections with zeros while retaining the
116 original attributes of the sections.
121 \fBExample 1 \fRPrinting a file's comment section
129 example% \fBmcs -p elf.file\fR
136 prints the comment section of the file \fBelf.file\fR.
139 \fBExample 2 \fRAppending a string to a comment section
147 example% \fBmcs -a xyz elf.file\fR
154 appends string \fBxyz\fR to \fBelf.file\fR's comment section.
157 \fBExample 3 \fRStripping a specified non-allocable section
160 Although used primarily with comment sections, \fBmcs\fR can operate on any
161 non-allocable section. In contrast to the \fBstrip\fR command, which removes a
162 predefined selection of non-allocable sections, \fBmcs\fR can be used to delete
163 a specific section. The following entry
168 example% \fBmcs -d -n .annotate elf.file\fR
175 removes the section named \fB\&.annotate\fR from the file \fBelf.file\fR.
181 \fB\fB/tmp/mcs*\fR\fR
190 See \fBattributes\fR(5) for descriptions of the following attributes:
198 ATTRIBUTE TYPE ATTRIBUTE VALUE
200 Interface Stability Stable
206 \fBar\fR(1), \fBas\fR(1), \fBld\fR(1), \fBstrip\fR(1), \fBar.h\fR(3HEAD),
207 \fBelf\fR(3ELF), \fBtmpnam\fR(3C), \fBa.out\fR(4), \fBattributes\fR(5)
211 When \fBmcs\fR deletes a section using the \fB-d\fR option, it tries to bind
212 together sections of type \fBSHT_REL\fR and target sections pointed to by the
213 \fBsh_info\fR section header field. If one is to be deleted, \fBmcs\fR attempts
214 to delete the other of the pair.
217 By using the \fB-z\fR option, it is possible to make an object file by removing
218 the contents of \fBSHT_PROGBITS\fR sections while retaining the object file's
219 original structure as an \fBELF\fR file. The need for use of the \fB-z\fR
220 option is limited. However, the option can be used to deliver an object file
221 when the contents of \fBSHT_PROGBITS\fR sections are not relevant.