xref: /freebsd/contrib/elftoolchain/readelf/readelf.1 (revision f161abf9f2cd7fdd28543f9774de82c89675477c)
1.\" Copyright (c) 2009,2011 Joseph Koshy <jkoshy@users.sourceforge.net>
2.\" All rights reserved.
3.\"
4.\" Redistribution and use in source and binary forms, with or without
5.\" modification, are permitted provided that the following conditions
6.\" are met:
7.\" 1. Redistributions of source code must retain the above copyright
8.\"    notice, this list of conditions and the following disclaimer
9.\"    in this position and unchanged.
10.\" 2. Redistributions in binary form must reproduce the above copyright
11.\"    notice, this list of conditions and the following disclaimer in the
12.\"    documentation and/or other materials provided with the distribution.
13.\"
14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHORS ``AS IS'' AND ANY EXPRESS OR
15.\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16.\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17.\" IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24.\"
25.\" $Id: readelf.1 3753 2019-06-28 01:13:13Z emaste $
26.\"
27.Dd September 17, 2021
28.Dt READELF 1
29.Os
30.Sh NAME
31.Nm readelf
32.Nd display information about ELF objects
33.Sh SYNOPSIS
34.Nm
35.Op Fl a | Fl -all
36.Op Fl c | Fl -archive-index
37.Op Fl d | Fl -dynamic
38.Op Fl e | Fl -headers
39.Op Fl g | Fl -section-groups
40.Op Fl h | Fl -file-header
41.Op Fl l | Fl -program-headers
42.Op Fl n | Fl -notes
43.Op Fl p Ar section | Fl -string-dump Ns = Ns Ar section
44.Op Fl r | Fl -relocs
45.Op Fl t | Fl -section-details
46.Op Fl v | Fl -version
47.Oo
48.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
49.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
50.Oc
51.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
52.Op Fl z | Fl -decompress
53.Op Fl A | Fl -arch-specific
54.Op Fl D | Fl -use-dynamic
55.Op Fl H | Fl -help
56.Op Fl I | Fl -histogram
57.Op Fl N | -full-section-name
58.Op Fl S | Fl -sections | Fl -section-headers
59.Op Fl V | Fl -version-info
60.Op Fl W | Fl -wide
61.Ar file...
62.Sh DESCRIPTION
63The
64.Nm
65utility displays information about ELF objects and
66.Xr ar 1
67archives.
68.Pp
69The
70.Nm
71utility recognizes the following options:
72.Bl -tag -width indent
73.It Fl a | Fl -all
74Turn on the following flags:
75.Fl d ,
76.Fl h ,
77.Fl I ,
78.Fl l ,
79.Fl n ,
80.Fl r ,
81.Fl s ,
82.Fl u ,
83.Fl A ,
84.Fl S
85and
86.Fl V .
87.It Fl c | Fl -archive-index
88Print the archive symbol table for archives.
89.It Fl d | Fl -dynamic
90Print the contents of the
91.Li SHT_DYNAMIC
92sections in the ELF object.
93.It Fl e | Fl -headers
94Print all program, file and section headers in the ELF object.
95.It Fl g | Fl -section-groups
96Print the contents of the section groups in the ELF object.
97.It Fl h | Fl -file-header
98Print the file header of the ELF object.
99.It Fl l | Fl -program-headers
100Print the content of the program header table for the object.
101.It Fl n | Fl -notes
102Print the contents of
103.Li PT_NOTE
104segments or
105.Li SHT_NOTE
106sections present in the ELF object.
107.It Fl p Ar section | Fl -string-dump Ns = Ns Ar section
108Print the contents of the specified section as printable strings.
109The argument
110.Ar section
111should be the name of a section or a numeric section index.
112.It Fl r | Fl -relocs
113Print relocation information.
114.It Fl s | Fl -syms | Fl -symbols
115Print symbol tables.
116.It Fl t | Fl -section-details
117Print additional information about sections, such as the flags
118fields in section headers.
119Implies
120.Fl S .
121.It Fl v | Fl -version
122Prints a version identifier for
123.Nm
124and exits.
125.It Fl w Ns Oo afilmoprsFLR Oc | Xo
126.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
127.Xc
128Display DWARF information.
129The
130.Fl w
131option is used with the short options in the following
132table; the
133.Fl -debug-dump
134option is used with a comma-separated list of the corresponding long
135option names:
136.Bl -column ".Em Short Option" "aranges|ranges"
137.It Em Short Option Ta Em Long Option Ta Em Description
138.It a Ta abbrev Ta Show abbreviation information.
139.It f Ta frames Ta Show frame information, displaying frame instructions.
140.It i Ta info Ta Show debugging information entries.
141.It l Ta rawline Ta Show line information in raw form.
142.It m Ta macro Ta Show macro information.
143.It o Ta loc Ta Show location list information.
144.It p Ta pubnames Ta Show global names.
145.It r Ta aranges|ranges Ta Show address range information.
146.It s Ta str Ta Show the debug string table.
147.It F Ta frames-interp Ta Show frame information, displaying register rules.
148.It L Ta decodedline Ta Show line information in decoded form.
149.It R Ta Ranges Ta Show range lists.
150.El
151.Pp
152If no sub-options are specified, the default is to show information
153corresponding to the
154.Ar a , f , i, l , o , p , r , s
155and
156.Ar R
157short options.
158.It Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
159Display the contents of the specified section in hexadecimal.
160The argument
161.Ar section
162should be the name of a section or a numeric section index.
163.It Fl z | Fl -decompress
164Decompress contents of sections specified by
165.Fl x
166or
167.Fl p
168before displaying.
169If the specified section is not compressed, it is displayed as is.
170.It Fl A | Fl -arch-specific
171This option is accepted but is currently unimplemented.
172.It Fl D | Fl -use-dynamic
173Print the symbol table specified by the
174.Li DT_SYMTAB
175entry in the
176.Dq Li .dynamic
177section.
178.It Fl H | Fl -help
179Print a help message.
180.It Fl I | Fl -histogram
181Print information on bucket list lengths for sections of type
182.Li SHT_HASH
183and
184.Li SHT_GNU_HASH .
185.It Fl N | Fl -full-section-name
186This option is accepted but is currently unimplemented.
187.It Fl S | Fl -sections | Fl -section-headers
188Print information in the section headers for each ELF object.
189.It Fl V | Fl -version-info
190Print symbol versioning information.
191.It Fl W | Fl -wide
192Print information about ELF structures using one long line per
193structure.
194If this option is not specified,
195.Nm
196will list information in the headers of 64 bit ELF objects on two
197separate lines.
198.El
199.Sh EXIT STATUS
200.Ex -std
201.Sh SEE ALSO
202.Xr nm 1 ,
203.Xr addr2line 1 ,
204.Xr elfcopy 1 ,
205.Sh AUTHORS
206The
207.Nm
208utility was written by
209.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
210