xref: /freebsd/contrib/elftoolchain/readelf/readelf.1 (revision f7c32ed617858bcd22f8d1b03199099d50125721)
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 u | Fl -unwind
47.Op Fl v | Fl -version
48.Oo
49.Fl w Ns Oo Ns Ar afilmoprsFLR Ns Oc |
50.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
51.Oc
52.Op Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
53.Op Fl z | Fl -decompress
54.Op Fl A | Fl -arch-specific
55.Op Fl D | Fl -use-dynamic
56.Op Fl H | Fl -help
57.Op Fl I | Fl -histogram
58.Op Fl N | -full-section-name
59.Op Fl S | Fl -sections | Fl -section-headers
60.Op Fl V | Fl -version-info
61.Op Fl W | Fl -wide
62.Ar file...
63.Sh DESCRIPTION
64The
65.Nm
66utility displays information about ELF objects and
67.Xr ar 1
68archives.
69.Pp
70The
71.Nm
72utility recognizes the following options:
73.Bl -tag -width indent
74.It Fl a | Fl -all
75Turn on the following flags:
76.Fl d ,
77.Fl h ,
78.Fl I ,
79.Fl l ,
80.Fl n ,
81.Fl r ,
82.Fl s ,
83.Fl u ,
84.Fl A ,
85.Fl S
86and
87.Fl V .
88.It Fl c | Fl -archive-index
89Print the archive symbol table for archives.
90.It Fl d | Fl -dynamic
91Print the contents of the
92.Li SHT_DYNAMIC
93sections in the ELF object.
94.It Fl e | Fl -headers
95Print all program, file and section headers in the ELF object.
96.It Fl g | Fl -section-groups
97Print the contents of the section groups in the ELF object.
98.It Fl h | Fl -file-header
99Print the file header of the ELF object.
100.It Fl l | Fl -program-headers
101Print the content of the program header table for the object.
102.It Fl n | Fl -notes
103Print the contents of
104.Li PT_NOTE
105segments or
106.Li SHT_NOTE
107sections present in the ELF object.
108.It Fl p Ar section | Fl -string-dump Ns = Ns Ar section
109Print the contents of the specified section as printable strings.
110The argument
111.Ar section
112should be the name of a section or a numeric section index.
113.It Fl r | Fl -relocs
114Print relocation information.
115.It Fl s | Fl -syms | Fl -symbols
116Print symbol tables.
117.It Fl t | Fl -section-details
118Print additional information about sections, such as the flags
119fields in section headers.
120Implies
121.Fl S .
122.It Fl u | Fl -unwind
123Not yet implemented (option accepted but ignored).
124.It Fl v | Fl -version
125Prints a version identifier for
126.Nm
127and exits.
128.It Fl w Ns Oo afilmoprsFLR Oc | Xo
129.Fl -debug-dump Ns Op Ns = Ns Ar long-option-name , Ns ...
130.Xc
131Display DWARF information.
132The
133.Fl w
134option is used with the short options in the following
135table; the
136.Fl -debug-dump
137option is used with a comma-separated list of the corresponding long
138option names:
139.Bl -column ".Em Short Option" "aranges|ranges"
140.It Em Short Option Ta Em Long Option Ta Em Description
141.It a Ta abbrev Ta Show abbreviation information.
142.It f Ta frames Ta Show frame information, displaying frame instructions.
143.It i Ta info Ta Show debugging information entries.
144.It l Ta rawline Ta Show line information in raw form.
145.It m Ta macro Ta Show macro information.
146.It o Ta loc Ta Show location list information.
147.It p Ta pubnames Ta Show global names.
148.It r Ta aranges|ranges Ta Show address range information.
149.It s Ta str Ta Show the debug string table.
150.It F Ta frames-interp Ta Show frame information, displaying register rules.
151.It L Ta decodedline Ta Show line information in decoded form.
152.It R Ta Ranges Ta Show range lists.
153.El
154.Pp
155If no sub-options are specified, the default is to show information
156corresponding to the
157.Ar a , f , i, l , o , p , r , s
158and
159.Ar R
160short options.
161.It Fl x Ar section | Fl -hex-dump Ns = Ns Ar section
162Display the contents of the specified section in hexadecimal.
163The argument
164.Ar section
165should be the name of a section or a numeric section index.
166.It Fl z | Fl -decompress
167Decompress contents of sections specified by
168.Fl x
169or
170.Fl p
171before displaying.
172If the specified section is not compressed, it is displayed as is.
173.It Fl A | Fl -arch-specific
174This option is accepted but is currently unimplemented.
175.It Fl D | Fl -use-dynamic
176Print the symbol table specified by the
177.Li DT_SYMTAB
178entry in the
179.Dq Li .dynamic
180section.
181.It Fl H | Fl -help
182Print a help message.
183.It Fl I | Fl -histogram
184Print information on bucket list lengths for sections of type
185.Li SHT_HASH
186and
187.Li SHT_GNU_HASH .
188.It Fl N | Fl -full-section-name
189This option is accepted but is currently unimplemented.
190.It Fl S | Fl -sections | Fl -section-headers
191Print information in the section headers for each ELF object.
192.It Fl V | Fl -version-info
193Print symbol versioning information.
194.It Fl W | Fl -wide
195Print information about ELF structures using one long line per
196structure.
197If this option is not specified,
198.Nm
199will list information in the headers of 64 bit ELF objects on two
200separate lines.
201.El
202.Sh EXIT STATUS
203.Ex -std
204.Sh SEE ALSO
205.Xr nm 1 ,
206.Xr addr2line 1 ,
207.Xr elfcopy 1 ,
208.Sh AUTHORS
209The
210.Nm
211utility was written by
212.An Kai Wang Aq Mt kaiwang27@users.sourceforge.net .
213