xref: /freebsd/contrib/elftoolchain/elfcopy/strip.1 (revision ad13e15e1d9d61a3383394f689ccd3a40bdb1d8e)
1a85fe12eSEd Maste.\" Copyright (c) 2011 Joseph Koshy.  All rights reserved.
2a85fe12eSEd Maste.\"
3a85fe12eSEd Maste.\" Redistribution and use in source and binary forms, with or without
4a85fe12eSEd Maste.\" modification, are permitted provided that the following conditions
5a85fe12eSEd Maste.\" are met:
6a85fe12eSEd Maste.\" 1. Redistributions of source code must retain the above copyright
7a85fe12eSEd Maste.\"    notice, this list of conditions and the following disclaimer.
8a85fe12eSEd Maste.\" 2. Redistributions in binary form must reproduce the above copyright
9a85fe12eSEd Maste.\"    notice, this list of conditions and the following disclaimer in the
10a85fe12eSEd Maste.\"    documentation and/or other materials provided with the distribution.
11a85fe12eSEd Maste.\"
12a85fe12eSEd Maste.\" THIS SOFTWARE IS PROVIDED BY JOSEPH KOSHY ``AS IS'' AND
13a85fe12eSEd Maste.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
14a85fe12eSEd Maste.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
15a85fe12eSEd Maste.\" ARE DISCLAIMED.  IN NO EVENT SHALL JOSEPH KOSHY BE LIABLE
16a85fe12eSEd Maste.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
17a85fe12eSEd Maste.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
18a85fe12eSEd Maste.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
19a85fe12eSEd Maste.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
20a85fe12eSEd Maste.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
21a85fe12eSEd Maste.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
22a85fe12eSEd Maste.\" SUCH DAMAGE.
23a85fe12eSEd Maste.\"
24ae500c1fSEd Maste.\" $Id: strip.1 3642 2018-10-14 14:24:28Z jkoshy $
25a85fe12eSEd Maste.\"
26*36d78189SMark Johnston.Dd July 27, 2019
27a85fe12eSEd Maste.Dt STRIP 1
28ae500c1fSEd Maste.Os
29a85fe12eSEd Maste.Sh NAME
30a85fe12eSEd Maste.Nm strip
31a85fe12eSEd Maste.Nd discard information from ELF objects
32a85fe12eSEd Maste.Sh SYNOPSIS
33a85fe12eSEd Maste.Nm
34a85fe12eSEd Maste.Op Fl d | Fl g | Fl S | Fl -strip-debug
35a85fe12eSEd Maste.Op Fl h | Fl -help
36a85fe12eSEd Maste.Op Fl -only-keep-debug
37a85fe12eSEd Maste.Op Fl o Ar outputfile | Fl -output-file= Ns Ar outputfile
38a85fe12eSEd Maste.Op Fl p | Fl -preserve-dates
39a85fe12eSEd Maste.Op Fl s | Fl -strip-all
40a85fe12eSEd Maste.Op Fl -strip-unneeded
41a85fe12eSEd Maste.Op Fl w | Fl -wildcard
42a85fe12eSEd Maste.Op Fl x | Fl -discard-all
43a85fe12eSEd Maste.Op Fl I Ar format | Fl -input-target= Ns Ar format
44a85fe12eSEd Maste.Op Fl K Ar symbol | Fl -keep-symbol= Ns Ar symbol
45a85fe12eSEd Maste.Op Fl N Ar symbol | Fl -strip-symbol= Ns Ar symbol
46a85fe12eSEd Maste.Op Fl O Ar format | Fl -output-target= Ns Ar format
47a85fe12eSEd Maste.Op Fl R Ar sectionname | Fl -remove-section= Ns Ar sectionname
48a85fe12eSEd Maste.Op Fl V | Fl -version
49a85fe12eSEd Maste.Op Fl X | Fl -discard-locals
50a85fe12eSEd Maste.Ar
51a85fe12eSEd Maste.Sh DESCRIPTION
52a85fe12eSEd MasteThe
53a85fe12eSEd Maste.Nm
54*36d78189SMark Johnstonutility is used to discard information from the ELF objects
55*36d78189SMark Johnstonspecified by the arguments
56*36d78189SMark Johnston.Ar .
57*36d78189SMark Johnston.Pp
58*36d78189SMark JohnstonIf an explicit output file name is not specified using the
59*36d78189SMark Johnston.Fl o
60*36d78189SMark Johnstonoption, the
61*36d78189SMark Johnston.Nm
62*36d78189SMark Johnstonutility will modify its input arguments in-place.
63a85fe12eSEd Maste.Pp
64a85fe12eSEd MasteThe
65a85fe12eSEd Maste.Nm
66a85fe12eSEd Masteutility supports the following options:
67a85fe12eSEd Maste.Bl -tag -width indent
68a85fe12eSEd Maste.It Fl d | Fl g | Fl S | Fl -strip-debug
69a85fe12eSEd MasteRemove debugging symbols only.
70a85fe12eSEd Maste.It Fl h | Fl -help
71a85fe12eSEd MastePrint a help message and exit.
72a85fe12eSEd Maste.It Fl -only-keep-debug
73a85fe12eSEd MasteRemove all content except that which would be used for debugging.
74a85fe12eSEd Maste.It Fl o Ar outputfile | Fl -output-file= Ns Ar outputfile
75a85fe12eSEd MasteWrite the stripped object to file
76*36d78189SMark Johnston.Ar outputfile
77*36d78189SMark Johnstoninstead of modifying the input in-place.
78*36d78189SMark JohnstonOnly a single input object should be specified if this option is used.
79a85fe12eSEd Maste.It Fl p | Fl -preserve-dates
80a85fe12eSEd MastePreserve the object's access and modification times.
81a85fe12eSEd Maste.It Fl s | Fl -strip-all
82a85fe12eSEd MasteRemove all symbols.
83a85fe12eSEd Maste.It Fl -strip-unneeded
84a85fe12eSEd MasteRemove all symbols not needed for further relocation processing.
85a85fe12eSEd Maste.It Fl w | Fl -wildcard
86a85fe12eSEd MasteUse shell-style patterns to name symbols.
87a85fe12eSEd MasteThe following meta-characters are recognized in patterns:
88a85fe12eSEd Maste.Bl -tag -width "...." -compact
89a85fe12eSEd Maste.It Li !
90a85fe12eSEd MasteIf this is the first character of the pattern, invert the sense of the
91a85fe12eSEd Mastepattern match.
92a85fe12eSEd Maste.It Li *
93a85fe12eSEd MasteMatches any string of characters in a symbol name.
94a85fe12eSEd Maste.It Li ?
95a85fe12eSEd MasteMatches zero or one character in a symbol name.
96a85fe12eSEd Maste.It Li [
97a85fe12eSEd MasteMark the start of a character class.
98a85fe12eSEd Maste.It Li \e
99a85fe12eSEd MasteRemove the special meaning of the next character in the pattern.
100a85fe12eSEd Maste.It Li ]
101a85fe12eSEd MasteMark the end of a character class.
102a85fe12eSEd Maste.El
103a85fe12eSEd Maste.It Fl x | Fl -discard-all
104a85fe12eSEd MasteDiscard all non-global symbols.
105a85fe12eSEd Maste.It Fl I Ar format | Fl -input-target= Ns Ar format
106a85fe12eSEd MasteThese options are accepted, but are ignored.
107a85fe12eSEd Maste.It Fl K Ar symbol | Fl -keep-symbol= Ns Ar symbol
108a85fe12eSEd MasteKeep the symbol
109a85fe12eSEd Maste.Ar symbol
110a85fe12eSEd Masteeven if it would otherwise be stripped.
111a85fe12eSEd MasteThis option may be specified multiple times.
112a85fe12eSEd Maste.It Fl N Ar symbol | Fl -strip-symbol= Ns Ar symbol
113a85fe12eSEd MasteRemove the symbol
114a85fe12eSEd Maste.Ar symbol
115a85fe12eSEd Masteeven if it would otherwise have been kept.
116a85fe12eSEd MasteThis option may be specified multiple times.
117a85fe12eSEd Maste.It Fl O Ar format | Fl -output-target= Ns Ar format
118a85fe12eSEd MasteSet the output file format to
119a85fe12eSEd Maste.Ar format .
120a85fe12eSEd MasteFor the full list of supported formats, please see the documentation
121a85fe12eSEd Mastefor function
122a85fe12eSEd Maste.Xr elftc_bfd_find_target 3 .
123a85fe12eSEd Maste.It Fl R Ar sectionname | Fl -remove-section= Ns Ar sectionname
124a85fe12eSEd MasteRemove the section named by the argument
125a85fe12eSEd Maste.Ar sectionname .
126a85fe12eSEd MasteThis option may be specified multiple times.
127a85fe12eSEd Maste.It Fl V | Fl -version
128a85fe12eSEd MastePrint a version identifier and exit.
129a85fe12eSEd Maste.It Fl X | Fl -discard-locals
130a85fe12eSEd MasteRemove compiler-generated local symbols.
131a85fe12eSEd Maste.El
132a85fe12eSEd Maste.Sh DIAGNOSTICS
133a85fe12eSEd Maste.Ex -std
134a85fe12eSEd Maste.Sh SEE ALSO
135a85fe12eSEd Maste.Xr ar 1 ,
136a85fe12eSEd Maste.Xr elfcopy 1 ,
137a85fe12eSEd Maste.Xr ld 1 ,
138a85fe12eSEd Maste.Xr mcs 1 ,
139a85fe12eSEd Maste.Xr elf 3 ,
140a85fe12eSEd Maste.Xr elftc_bfd_find_target 3 ,
141a85fe12eSEd Maste.Xr fnmatch 3
142