1mcs(1) User Commands mcs(1)
2
3
4
6 mcs - manipulate the comment section of an object file
7
9 mcs [-cdpVz] [-a string] [-n name] file...
10
11
13 The mcs command is used to manipulate a section, by default the .com‐
14 ment section, in an ELF object file. It is used to add to, delete,
15 print, and compress the contents of a section in an ELF object file,
16 and print only the contents of a section in a COFF object file. mcs
17 cannot add, delete, or compress the contents of a section that is con‐
18 tained within a segment.
19
20
21 If the input file is an archive (see ar.h(3HEAD)), the archive is
22 treated as a set of individual files. For example, if the -a option is
23 specified, the string is appended to the comment section of each ELF
24 object file in the archive; if the archive member is not an ELF object
25 file, then it is left unchanged.
26
27
28 mcs must be given one or more of the options described below. It
29 applies, in order, each of the specified options to each file.
30
31
32 For operations other than delete, if the object does not already con‐
33 tain a section with the specified name, mcs will create a new empty
34 section with that name before performing the specified operation.
35
37 The following options are supported:
38
39 -a string Appends string to the comment section of the ELF object
40 files. If string contains embedded blanks, it must be
41 enclosed in quotation marks.
42
43
44 -c Compresses the contents of the comment section of the ELF
45 object files. All duplicate entries are removed. The
46 ordering of the remaining entries is not disturbed.
47
48
49 -d Deletes the contents of the specified section from the ELF
50 object files. The section header for the comment section
51 is also removed.
52
53
54 -n name Specifies the name of the section to access if other than
55 .comment. By default, mcs deals with the section named
56 .comment. This option can be used to specify another sec‐
57 tion. mcs can take multiple -n options to allow for speci‐
58 fication of multiple sections.
59
60
61 -p Prints the contents of the comment section on the standard
62 output. Each section printed is tagged by the name of the
63 file from which it was extracted, using the format
64 file[member_name]: for archive files and file: for other
65 files.
66
67
68 -V Prints on standard error the version number of mcs.
69
70
71 -z Replaces any SHT_PROGBITS sections with zeros while
72 retaining the original attributes of the sections.
73
74
76 Example 1 Printing a file's comment section
77
78
79 The following entry
80
81
82 example% mcs -p elf.file
83
84
85
86
87 prints the comment section of the file elf.file.
88
89
90 Example 2 Appending a string to a comment section
91
92
93 The following entry
94
95
96 example% mcs -a xyz elf.file
97
98
99
100
101 appends string xyz to elf.file's comment section.
102
103
104 Example 3 Stripping a specified non-allocable section
105
106
107 Although used primarily with comment sections, mcs can operate on any
108 non-allocable section. In contrast to the strip command, which removes
109 a predefined selection of non-allocable sections, mcs can be used to
110 delete a specific section. The following entry
111
112
113 example% mcs -d -n .annotate elf.file
114
115
116
117
118 removes the section named .annotate from the file elf.file.
119
120
122 /tmp/mcs* temporary files
123
124
126 See attributes(5) for descriptions of the following attributes:
127
128
129
130
131 ┌─────────────────────────────┬─────────────────────────────┐
132 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
133 ├─────────────────────────────┼─────────────────────────────┤
134 │Availability │SUNWbtool │
135 ├─────────────────────────────┼─────────────────────────────┤
136 │Interface Stability │Stable │
137 └─────────────────────────────┴─────────────────────────────┘
138
140 ar(1), as(1), ld(1), strip(1), ar.h(3HEAD), elf(3ELF), tmpnam(3C),
141 a.out(4), attributes(5)
142
144 When mcs deletes a section using the -d option, it tries to bind
145 together sections of type SHT_REL and target sections pointed to by the
146 sh_info section header field. If one is to be deleted, mcs attempts to
147 delete the other of the pair.
148
149
150 By using the -z option, it is possible to make an object file by remov‐
151 ing the contents of SHT_PROGBITS sections while retaining the object
152 file's original structure as an ELF file. The need for use of the -z
153 option is limited. However, the option can be used to deliver an object
154 file when the contents of SHT_PROGBITS sections are not relevant.
155
156
157
158SunOS 5.11 5 Oct 2007 mcs(1)