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