LLDB  mainline
ELFHeader.h
Go to the documentation of this file.
1 //===-- ELFHeader.h ------------------------------------------- -*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 //
9 /// \file
10 /// Generic structures and typedefs for ELF files.
11 ///
12 /// This file provides definitions for the various entities comprising an ELF
13 /// file. The structures are generic in the sense that they do not correspond
14 /// to the exact binary layout of an ELF, but can be used to hold the
15 /// information present in both 32 and 64 bit variants of the format. Each
16 /// entity provides a \c Parse method which is capable of transparently
17 /// reading both 32 and 64 bit instances of the object.
18 //===----------------------------------------------------------------------===//
19 
20 #ifndef LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_ELFHEADER_H
21 #define LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_ELFHEADER_H
22 
23 #include "llvm/BinaryFormat/ELF.h"
24 
25 #include "lldb/lldb-enumerations.h"
26 #include "lldb/lldb-types.h"
27 
28 namespace lldb_private {
29 class DataExtractor;
30 } // End namespace lldb_private.
31 
32 namespace elf {
33 
34 /// \name ELF type definitions.
35 ///
36 /// Types used to represent the various components of ELF structures. All
37 /// types are signed or unsigned integral types wide enough to hold values
38 /// from both
39 /// 32 and 64 bit ELF variants.
40 //@{
41 typedef uint64_t elf_addr;
42 typedef uint64_t elf_off;
45 typedef int32_t elf_sword;
46 typedef uint64_t elf_size;
47 typedef uint64_t elf_xword;
48 typedef int64_t elf_sxword;
49 //@}
50 
51 /// \class ELFHeader
52 /// Generic representation of an ELF file header.
53 ///
54 /// This object is used to identify the general attributes on an ELF file and
55 /// to locate additional sections within the file.
56 struct ELFHeader {
57  unsigned char e_ident[llvm::ELF::EI_NIDENT]; ///< ELF file identification.
58  elf_addr e_entry; ///< Virtual address program entry point.
59  elf_off e_phoff; ///< File offset of program header table.
60  elf_off e_shoff; ///< File offset of section header table.
61  elf_word e_flags; ///< Processor specific flags.
62  elf_word e_version; ///< Version of object file (always 1).
63  elf_half e_type; ///< Object file type.
64  elf_half e_machine; ///< Target architecture.
65  elf_half e_ehsize; ///< Byte size of the ELF header.
66  elf_half e_phentsize; ///< Size of a program header table entry.
67  elf_half e_phnum_hdr; ///< Number of program header entries.
68  elf_half e_shentsize; ///< Size of a section header table entry.
69  elf_half e_shnum_hdr; ///< Number of section header entries.
70  elf_half e_shstrndx_hdr; ///< String table section index.
71 
72  // In some cases these numbers do not fit in 16 bits and they are
73  // stored outside of the header in section #0. Here are the actual
74  // values.
75  elf_word e_phnum; ///< Number of program header entries.
76  elf_word e_shnum; ///< Number of section header entries.
77  elf_word e_shstrndx; ///< String table section index.
78 
79  ELFHeader();
80 
81  /// Returns true if this is a 32 bit ELF file header.
82  ///
83  /// \return
84  /// True if this is a 32 bit ELF file header.
85  bool Is32Bit() const {
86  return e_ident[llvm::ELF::EI_CLASS] == llvm::ELF::ELFCLASS32;
87  }
88 
89  /// Returns true if this is a 64 bit ELF file header.
90  ///
91  /// \return
92  /// True if this is a 64 bit ELF file header.
93  bool Is64Bit() const {
94  return e_ident[llvm::ELF::EI_CLASS] == llvm::ELF::ELFCLASS64;
95  }
96 
97  /// The byte order of this ELF file header.
98  ///
99  /// \return
100  /// The byte order of this ELF file as described by the header.
102 
103  /// The jump slot relocation type of this ELF.
104  unsigned GetRelocationJumpSlotType() const;
105 
106  /// Check if there should be header extension in section header #0
107  ///
108  /// \return
109  /// True if parsing the ELFHeader requires reading header extension
110  /// and false otherwise.
111  bool HasHeaderExtension() const;
112 
113  /// Parse an ELFHeader entry starting at position \p offset and update the
114  /// data extractor with the address size and byte order attributes as
115  /// defined by the header.
116  ///
117  /// \param[in,out] data
118  /// The DataExtractor to read from. Updated with the address size and
119  /// byte order attributes appropriate to this header.
120  ///
121  /// \param[in,out] offset
122  /// Pointer to an offset in the data. On return the offset will be
123  /// advanced by the number of bytes read.
124  ///
125  /// \return
126  /// True if the ELFHeader was successfully read and false
127  /// otherwise.
128  bool Parse(lldb_private::DataExtractor &data, lldb::offset_t *offset);
129 
130  /// Examines at most EI_NIDENT bytes starting from the given pointer and
131  /// determines if the magic ELF identification exists.
132  ///
133  /// \return
134  /// True if the given sequence of bytes identifies an ELF file.
135  static bool MagicBytesMatch(const uint8_t *magic);
136 
137  /// Examines at most EI_NIDENT bytes starting from the given address and
138  /// determines the address size of the underlying ELF file. This function
139  /// should only be called on an pointer for which MagicBytesMatch returns
140  /// true.
141  ///
142  /// \return
143  /// The number of bytes forming an address in the ELF file (either 4 or
144  /// 8), else zero if the address size could not be determined.
145  static unsigned AddressSizeInBytes(const uint8_t *magic);
146 
147 private:
148 
149  /// Parse an ELFHeader header extension entry. This method is called by
150  /// Parse().
151  ///
152  /// \param[in] data
153  /// The DataExtractor to read from.
155 };
156 
157 /// \class ELFSectionHeader
158 /// Generic representation of an ELF section header.
160  elf_word sh_name; ///< Section name string index.
161  elf_word sh_type; ///< Section type.
162  elf_xword sh_flags; ///< Section attributes.
163  elf_addr sh_addr; ///< Virtual address of the section in memory.
164  elf_off sh_offset; ///< Start of section from beginning of file.
165  elf_xword sh_size; ///< Number of bytes occupied in the file.
166  elf_word sh_link; ///< Index of associated section.
167  elf_word sh_info; ///< Extra section info (overloaded).
168  elf_xword sh_addralign; ///< Power of two alignment constraint.
169  elf_xword sh_entsize; ///< Byte size of each section entry.
170 
172 
173  /// Parse an ELFSectionHeader entry from the given DataExtracter starting at
174  /// position \p offset.
175  ///
176  /// \param[in] data
177  /// The DataExtractor to read from. The address size of the extractor
178  /// determines if a 32 or 64 bit object should be read.
179  ///
180  /// \param[in,out] offset
181  /// Pointer to an offset in the data. On return the offset will be
182  /// advanced by the number of bytes read.
183  ///
184  /// \return
185  /// True if the ELFSectionHeader was successfully read and false
186  /// otherwise.
187  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
188 };
189 
190 /// \class ELFProgramHeader
191 /// Generic representation of an ELF program header.
193  elf_word p_type; ///< Type of program segment.
194  elf_word p_flags; ///< Segment attributes.
195  elf_off p_offset; ///< Start of segment from beginning of file.
196  elf_addr p_vaddr; ///< Virtual address of segment in memory.
197  elf_addr p_paddr; ///< Physical address (for non-VM systems).
198  elf_xword p_filesz; ///< Byte size of the segment in file.
199  elf_xword p_memsz; ///< Byte size of the segment in memory.
200  elf_xword p_align; ///< Segment alignment constraint.
201 
203 
204  /// Parse an ELFProgramHeader entry from the given DataExtractor starting at
205  /// position \p offset. The address size of the DataExtractor determines if
206  /// a 32 or 64 bit object is to be parsed.
207  ///
208  /// \param[in] data
209  /// The DataExtractor to read from. The address size of the extractor
210  /// determines if a 32 or 64 bit object should be read.
211  ///
212  /// \param[in,out] offset
213  /// Pointer to an offset in the data. On return the offset will be
214  /// advanced by the number of bytes read.
215  ///
216  /// \return
217  /// True if the ELFProgramHeader was successfully read and false
218  /// otherwise.
219  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
220 };
221 
222 /// \class ELFSymbol
223 /// Represents a symbol within an ELF symbol table.
224 struct ELFSymbol {
225  elf_addr st_value; ///< Absolute or relocatable address.
226  elf_xword st_size; ///< Size of the symbol or zero.
227  elf_word st_name; ///< Symbol name string index.
228  unsigned char st_info; ///< Symbol type and binding attributes.
229  unsigned char st_other; ///< Reserved for future use.
230  elf_half st_shndx; ///< Section to which this symbol applies.
231 
232  ELFSymbol();
233 
234  /// Returns the binding attribute of the st_info member.
235  unsigned char getBinding() const { return st_info >> 4; }
236 
237  /// Returns the type attribute of the st_info member.
238  unsigned char getType() const { return st_info & 0x0F; }
239 
240  /// Sets the binding and type of the st_info member.
241  void setBindingAndType(unsigned char binding, unsigned char type) {
242  st_info = (binding << 4) + (type & 0x0F);
243  }
244 
245  static const char *bindingToCString(unsigned char binding);
246 
247  static const char *typeToCString(unsigned char type);
248 
249  static const char *
251  const lldb_private::SectionList *section_list);
252 
253  /// Parse an ELFSymbol entry from the given DataExtractor starting at
254  /// position \p offset. The address size of the DataExtractor determines if
255  /// a 32 or 64 bit object is to be parsed.
256  ///
257  /// \param[in] data
258  /// The DataExtractor to read from. The address size of the extractor
259  /// determines if a 32 or 64 bit object should be read.
260  ///
261  /// \param[in,out] offset
262  /// Pointer to an offset in the data. On return the offset will be
263  /// advanced by the number of bytes read.
264  ///
265  /// \return
266  /// True if the ELFSymbol was successfully read and false otherwise.
267  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
268 
269  void Dump(lldb_private::Stream *s, uint32_t idx,
270  const lldb_private::DataExtractor *strtab_data,
271  const lldb_private::SectionList *section_list);
272 };
273 
274 /// \class ELFDynamic
275 /// Represents an entry in an ELF dynamic table.
276 struct ELFDynamic {
277  elf_sxword d_tag; ///< Type of dynamic table entry.
278  union {
279  elf_xword d_val; ///< Integer value of the table entry.
280  elf_addr d_ptr; ///< Pointer value of the table entry.
281  };
282 
283  ELFDynamic();
284 
285  /// Parse an ELFDynamic entry from the given DataExtractor starting at
286  /// position \p offset. The address size of the DataExtractor determines if
287  /// a 32 or 64 bit object is to be parsed.
288  ///
289  /// \param[in] data
290  /// The DataExtractor to read from. The address size of the extractor
291  /// determines if a 32 or 64 bit object should be read.
292  ///
293  /// \param[in,out] offset
294  /// Pointer to an offset in the data. On return the offset will be
295  /// advanced by the number of bytes read.
296  ///
297  /// \return
298  /// True if the ELFDynamic entry was successfully read and false
299  /// otherwise.
300  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
301 };
302 
303 /// \class ELFRel
304 /// Represents a relocation entry with an implicit addend.
305 struct ELFRel {
306  elf_addr r_offset; ///< Address of reference.
307  elf_xword r_info; ///< symbol index and type of relocation.
308 
309  ELFRel();
310 
311  /// Parse an ELFRel entry from the given DataExtractor starting at position
312  /// \p offset. The address size of the DataExtractor determines if a 32 or
313  /// 64 bit object is to be parsed.
314  ///
315  /// \param[in] data
316  /// The DataExtractor to read from. The address size of the extractor
317  /// determines if a 32 or 64 bit object should be read.
318  ///
319  /// \param[in,out] offset
320  /// Pointer to an offset in the data. On return the offset will be
321  /// advanced by the number of bytes read.
322  ///
323  /// \return
324  /// True if the ELFRel entry was successfully read and false otherwise.
325  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
326 
327  /// Returns the type when the given entry represents a 32-bit relocation.
328  static unsigned RelocType32(const ELFRel &rel) { return rel.r_info & 0x0ff; }
329 
330  /// Returns the type when the given entry represents a 64-bit relocation.
331  static unsigned RelocType64(const ELFRel &rel) {
332  return rel.r_info & 0xffffffff;
333  }
334 
335  /// Returns the symbol index when the given entry represents a 32-bit
336  /// relocation.
337  static unsigned RelocSymbol32(const ELFRel &rel) { return rel.r_info >> 8; }
338 
339  /// Returns the symbol index when the given entry represents a 64-bit
340  /// relocation.
341  static unsigned RelocSymbol64(const ELFRel &rel) { return rel.r_info >> 32; }
342 };
343 
344 /// \class ELFRela
345 /// Represents a relocation entry with an explicit addend.
346 struct ELFRela {
347  elf_addr r_offset; ///< Address of reference.
348  elf_xword r_info; ///< Symbol index and type of relocation.
349  elf_sxword r_addend; ///< Constant part of expression.
350 
351  ELFRela();
352 
353  /// Parse an ELFRela entry from the given DataExtractor starting at position
354  /// \p offset. The address size of the DataExtractor determines if a 32 or
355  /// 64 bit object is to be parsed.
356  ///
357  /// \param[in] data
358  /// The DataExtractor to read from. The address size of the extractor
359  /// determines if a 32 or 64 bit object should be read.
360  ///
361  /// \param[in,out] offset
362  /// Pointer to an offset in the data. On return the offset will be
363  /// advanced by the number of bytes read.
364  ///
365  /// \return
366  /// True if the ELFRela entry was successfully read and false otherwise.
367  bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset);
368 
369  /// Returns the type when the given entry represents a 32-bit relocation.
370  static unsigned RelocType32(const ELFRela &rela) {
371  return rela.r_info & 0x0ff;
372  }
373 
374  /// Returns the type when the given entry represents a 64-bit relocation.
375  static unsigned RelocType64(const ELFRela &rela) {
376  return rela.r_info & 0xffffffff;
377  }
378 
379  /// Returns the symbol index when the given entry represents a 32-bit
380  /// relocation.
381  static unsigned RelocSymbol32(const ELFRela &rela) {
382  return rela.r_info >> 8;
383  }
384 
385  /// Returns the symbol index when the given entry represents a 64-bit
386  /// relocation.
387  static unsigned RelocSymbol64(const ELFRela &rela) {
388  return rela.r_info >> 32;
389  }
390 };
391 
392 } // End namespace elf.
393 
394 #endif // LLDB_SOURCE_PLUGINS_OBJECTFILE_ELF_ELFHEADER_H
elf::ELFProgramHeader::p_align
elf_xword p_align
Segment alignment constraint.
Definition: ELFHeader.h:200
elf::elf_addr
uint64_t elf_addr
Definition: ELFHeader.h:41
elf::ELFSymbol::st_size
elf_xword st_size
Size of the symbol or zero.
Definition: ELFHeader.h:226
elf::ELFSectionHeader::sh_info
elf_word sh_info
Extra section info (overloaded).
Definition: ELFHeader.h:167
elf::ELFSectionHeader::sh_type
elf_word sh_type
Section type.
Definition: ELFHeader.h:161
elf::ELFDynamic::ELFDynamic
ELFDynamic()
Definition: ELFHeader.cpp:398
elf::ELFHeader
Definition: ELFHeader.h:56
elf::ELFSectionHeader::sh_offset
elf_off sh_offset
Start of section from beginning of file.
Definition: ELFHeader.h:164
elf::ELFHeader::e_shstrndx_hdr
elf_half e_shstrndx_hdr
String table section index.
Definition: ELFHeader.h:70
elf::elf_xword
uint64_t elf_xword
Definition: ELFHeader.h:47
elf::ELFProgramHeader::p_vaddr
elf_addr p_vaddr
Virtual address of segment in memory.
Definition: ELFHeader.h:196
elf::ELFRela::ELFRela
ELFRela()
Definition: ELFHeader.cpp:420
elf::ELFHeader::HasHeaderExtension
bool HasHeaderExtension() const
Check if there should be header extension in section header #0.
Definition: ELFHeader.cpp:81
elf::ELFSymbol::st_shndx
elf_half st_shndx
Section to which this symbol applies.
Definition: ELFHeader.h:230
elf::ELFHeader::GetRelocationJumpSlotType
unsigned GetRelocationJumpSlotType() const
The jump slot relocation type of this ELF.
Definition: ELFHeader.cpp:176
elf::ELFHeader::ELFHeader
ELFHeader()
Definition: ELFHeader.cpp:71
elf::ELFHeader::Parse
bool Parse(lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFHeader entry starting at position offset and update the data extractor with the address s...
Definition: ELFHeader.cpp:114
elf::ELFHeader::e_version
elf_word e_version
Version of object file (always 1).
Definition: ELFHeader.h:62
elf::ELFSectionHeader::sh_flags
elf_xword sh_flags
Section attributes.
Definition: ELFHeader.h:162
elf::ELFHeader::e_ident
unsigned char e_ident[llvm::ELF::EI_NIDENT]
ELF file identification.
Definition: ELFHeader.h:57
elf::ELFSymbol::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFSymbol entry from the given DataExtractor starting at position offset.
Definition: ELFHeader.cpp:319
elf::ELFSymbol::setBindingAndType
void setBindingAndType(unsigned char binding, unsigned char type)
Sets the binding and type of the st_info member.
Definition: ELFHeader.h:241
elf::ELFDynamic::d_val
elf_xword d_val
Integer value of the table entry.
Definition: ELFHeader.h:279
elf::ELFRela::r_offset
elf_addr r_offset
Address of reference.
Definition: ELFHeader.h:347
elf::ELFSymbol::ELFSymbol
ELFSymbol()
Definition: ELFHeader.cpp:251
elf::ELFHeader::e_flags
elf_word e_flags
Processor specific flags.
Definition: ELFHeader.h:61
elf::ELFProgramHeader::p_memsz
elf_xword p_memsz
Byte size of the segment in memory.
Definition: ELFHeader.h:199
elf::ELFRel::RelocType32
static unsigned RelocType32(const ELFRel &rel)
Returns the type when the given entry represents a 32-bit relocation.
Definition: ELFHeader.h:328
elf::ELFSectionHeader::sh_size
elf_xword sh_size
Number of bytes occupied in the file.
Definition: ELFHeader.h:165
elf::ELFRel::r_offset
elf_addr r_offset
Address of reference.
Definition: ELFHeader.h:306
elf::ELFRela::RelocSymbol64
static unsigned RelocSymbol64(const ELFRela &rela)
Returns the symbol index when the given entry represents a 64-bit relocation.
Definition: ELFHeader.h:387
elf::ELFHeader::GetByteOrder
lldb::ByteOrder GetByteOrder() const
The byte order of this ELF file header.
Definition: ELFHeader.cpp:73
elf::ELFHeader::e_phnum
elf_word e_phnum
Number of program header entries.
Definition: ELFHeader.h:75
elf::ELFSectionHeader::sh_addr
elf_addr sh_addr
Virtual address of the section in memory.
Definition: ELFHeader.h:163
lldb_private::SectionList
Definition: Section.h:34
lldb::offset_t
uint64_t offset_t
Definition: lldb-types.h:87
elf::ELFHeader::Is64Bit
bool Is64Bit() const
Returns true if this is a 64 bit ELF file header.
Definition: ELFHeader.h:93
elf::ELFProgramHeader::p_paddr
elf_addr p_paddr
Physical address (for non-VM systems).
Definition: ELFHeader.h:197
elf::ELFRel::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFRel entry from the given DataExtractor starting at position offset.
Definition: ELFHeader.cpp:410
lldb_private::Stream
Definition: Stream.h:28
elf::ELFHeader::e_entry
elf_addr e_entry
Virtual address program entry point.
Definition: ELFHeader.h:58
elf::ELFSymbol::getType
unsigned char getType() const
Returns the type attribute of the st_info member.
Definition: ELFHeader.h:238
elf::ELFProgramHeader::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFProgramHeader entry from the given DataExtractor starting at position offset.
Definition: ELFHeader.cpp:362
elf::ELFHeader::e_machine
elf_half e_machine
Target architecture.
Definition: ELFHeader.h:64
elf::ELFProgramHeader::p_flags
elf_word p_flags
Segment attributes.
Definition: ELFHeader.h:194
elf::ELFSectionHeader::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFSectionHeader entry from the given DataExtracter starting at position offset.
Definition: ELFHeader.cpp:222
elf::ELFDynamic::d_ptr
elf_addr d_ptr
Pointer value of the table entry.
Definition: ELFHeader.h:280
elf::ELFDynamic::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFDynamic entry from the given DataExtractor starting at position offset.
Definition: ELFHeader.cpp:400
elf::ELFSymbol::st_name
elf_word st_name
Symbol name string index.
Definition: ELFHeader.h:227
elf::ELFSectionHeader
Definition: ELFHeader.h:159
elf::ELFHeader::AddressSizeInBytes
static unsigned AddressSizeInBytes(const uint8_t *magic)
Examines at most EI_NIDENT bytes starting from the given address and determines the address size of t...
Definition: ELFHeader.cpp:161
elf::ELFRela::Parse
bool Parse(const lldb_private::DataExtractor &data, lldb::offset_t *offset)
Parse an ELFRela entry from the given DataExtractor starting at position offset.
Definition: ELFHeader.cpp:422
elf::ELFHeader::e_phoff
elf_off e_phoff
File offset of program header table.
Definition: ELFHeader.h:59
elf::ELFSymbol
Definition: ELFHeader.h:224
elf::ELFSymbol::sectionIndexToCString
static const char * sectionIndexToCString(elf_half shndx, const lldb_private::SectionList *section_list)
Definition: ELFHeader.cpp:287
lldb_private::DataExtractor
Definition: DataExtractor.h:48
elf::ELFHeader::e_type
elf_half e_type
Object file type.
Definition: ELFHeader.h:63
elf::ELFRel
Definition: ELFHeader.h:305
elf::ELFHeader::e_shnum_hdr
elf_half e_shnum_hdr
Number of section header entries.
Definition: ELFHeader.h:69
elf::elf_off
uint64_t elf_off
Definition: ELFHeader.h:42
elf::ELFDynamic
Definition: ELFHeader.h:276
elf::ELFSectionHeader::sh_name
elf_word sh_name
Section name string index.
Definition: ELFHeader.h:160
elf::ELFHeader::Is32Bit
bool Is32Bit() const
Returns true if this is a 32 bit ELF file header.
Definition: ELFHeader.h:85
elf::ELFRel::RelocType64
static unsigned RelocType64(const ELFRel &rel)
Returns the type when the given entry represents a 64-bit relocation.
Definition: ELFHeader.h:331
lldb-enumerations.h
elf
Definition: ELFHeader.h:32
elf::ELFSymbol::st_info
unsigned char st_info
Symbol type and binding attributes.
Definition: ELFHeader.h:228
elf::ELFHeader::e_phnum_hdr
elf_half e_phnum_hdr
Number of program header entries.
Definition: ELFHeader.h:67
elf::ELFProgramHeader::p_type
elf_word p_type
Type of program segment.
Definition: ELFHeader.h:193
elf::ELFProgramHeader::ELFProgramHeader
ELFProgramHeader()
Definition: ELFHeader.cpp:358
elf::ELFHeader::e_ehsize
elf_half e_ehsize
Byte size of the ELF header.
Definition: ELFHeader.h:65
elf::ELFHeader::e_shoff
elf_off e_shoff
File offset of section header table.
Definition: ELFHeader.h:60
elf::elf_size
uint64_t elf_size
Definition: ELFHeader.h:46
elf::ELFHeader::e_phentsize
elf_half e_phentsize
Size of a program header table entry.
Definition: ELFHeader.h:66
elf::ELFSectionHeader::ELFSectionHeader
ELFSectionHeader()
Definition: ELFHeader.cpp:218
elf::ELFRela::RelocSymbol32
static unsigned RelocSymbol32(const ELFRela &rela)
Returns the symbol index when the given entry represents a 32-bit relocation.
Definition: ELFHeader.h:381
lldb-types.h
elf::ELFSectionHeader::sh_entsize
elf_xword sh_entsize
Byte size of each section entry.
Definition: ELFHeader.h:169
elf::ELFSymbol::Dump
void Dump(lldb_private::Stream *s, uint32_t idx, const lldb_private::DataExtractor *strtab_data, const lldb_private::SectionList *section_list)
Definition: ELFHeader.cpp:308
elf::ELFDynamic::d_tag
elf_sxword d_tag
Type of dynamic table entry.
Definition: ELFHeader.h:277
elf::ELFSymbol::bindingToCString
static const char * bindingToCString(unsigned char binding)
Definition: ELFHeader.cpp:257
elf::ELFRela::RelocType64
static unsigned RelocType64(const ELFRela &rela)
Returns the type when the given entry represents a 64-bit relocation.
Definition: ELFHeader.h:375
elf::ELFHeader::e_shentsize
elf_half e_shentsize
Size of a section header table entry.
Definition: ELFHeader.h:68
elf::ELFRela::r_addend
elf_sxword r_addend
Constant part of expression.
Definition: ELFHeader.h:349
uint32_t
elf::ELFSymbol::typeToCString
static const char * typeToCString(unsigned char type)
Definition: ELFHeader.cpp:270
elf::ELFHeader::MagicBytesMatch
static bool MagicBytesMatch(const uint8_t *magic)
Examines at most EI_NIDENT bytes starting from the given pointer and determines if the magic ELF iden...
Definition: ELFHeader.cpp:157
elf::elf_sword
int32_t elf_sword
Definition: ELFHeader.h:45
elf::ELFProgramHeader
Definition: ELFHeader.h:192
elf::ELFSymbol::st_value
elf_addr st_value
Absolute or relocatable address.
Definition: ELFHeader.h:225
uint16_t
elf::elf_sxword
int64_t elf_sxword
Definition: ELFHeader.h:48
elf::ELFRel::RelocSymbol32
static unsigned RelocSymbol32(const ELFRel &rel)
Returns the symbol index when the given entry represents a 32-bit relocation.
Definition: ELFHeader.h:337
elf::ELFRela::r_info
elf_xword r_info
Symbol index and type of relocation.
Definition: ELFHeader.h:348
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
elf::ELFRel::r_info
elf_xword r_info
symbol index and type of relocation.
Definition: ELFHeader.h:307
elf::ELFRel::ELFRel
ELFRel()
Definition: ELFHeader.cpp:408
elf::ELFSymbol::getBinding
unsigned char getBinding() const
Returns the binding attribute of the st_info member.
Definition: ELFHeader.h:235
elf::ELFProgramHeader::p_filesz
elf_xword p_filesz
Byte size of the segment in file.
Definition: ELFHeader.h:198
elf::ELFRela
Definition: ELFHeader.h:346
elf::ELFRel::RelocSymbol64
static unsigned RelocSymbol64(const ELFRel &rel)
Returns the symbol index when the given entry represents a 64-bit relocation.
Definition: ELFHeader.h:341
elf::ELFHeader::e_shstrndx
elf_word e_shstrndx
String table section index.
Definition: ELFHeader.h:77
elf::ELFHeader::e_shnum
elf_word e_shnum
Number of section header entries.
Definition: ELFHeader.h:76
elf::elf_half
uint16_t elf_half
Definition: ELFHeader.h:43
elf::elf_word
uint32_t elf_word
Definition: ELFHeader.h:44
elf::ELFSectionHeader::sh_addralign
elf_xword sh_addralign
Power of two alignment constraint.
Definition: ELFHeader.h:168
elf::ELFRela::RelocType32
static unsigned RelocType32(const ELFRela &rela)
Returns the type when the given entry represents a 32-bit relocation.
Definition: ELFHeader.h:370
elf::ELFSymbol::st_other
unsigned char st_other
Reserved for future use.
Definition: ELFHeader.h:229
elf::ELFProgramHeader::p_offset
elf_off p_offset
Start of segment from beginning of file.
Definition: ELFHeader.h:195
lldb::ByteOrder
ByteOrder
Byte ordering definitions.
Definition: lldb-enumerations.h:138
elf::ELFSectionHeader::sh_link
elf_word sh_link
Index of associated section.
Definition: ELFHeader.h:166
elf::ELFHeader::ParseHeaderExtension
void ParseHeaderExtension(lldb_private::DataExtractor &data)
Parse an ELFHeader header extension entry.
Definition: ELFHeader.cpp:96