LLVM API Documentation

ELFTypes.h
Go to the documentation of this file.
00001 //===- ELFTypes.h - Endian specific types for ELF ---------------*- C++ -*-===//
00002 //
00003 //                     The LLVM Compiler Infrastructure
00004 //
00005 // This file is distributed under the University of Illinois Open Source
00006 // License. See LICENSE.TXT for details.
00007 //
00008 //===----------------------------------------------------------------------===//
00009 
00010 #ifndef LLVM_OBJECT_ELFTYPES_H
00011 #define LLVM_OBJECT_ELFTYPES_H
00012 
00013 #include "llvm/Support/AlignOf.h"
00014 #include "llvm/Support/DataTypes.h"
00015 #include "llvm/Support/ELF.h"
00016 #include "llvm/Support/Endian.h"
00017 
00018 namespace llvm {
00019 namespace object {
00020 
00021 using support::endianness;
00022 
00023 template <endianness target_endianness, std::size_t max_alignment,
00024           bool is64Bits>
00025 struct ELFType {
00026   static const endianness TargetEndianness = target_endianness;
00027   static const std::size_t MaxAlignment = max_alignment;
00028   static const bool Is64Bits = is64Bits;
00029 };
00030 
00031 template <typename T, int max_align> struct MaximumAlignment {
00032   enum { value = AlignOf<T>::Alignment > max_align ? max_align
00033                                                    : AlignOf<T>::Alignment
00034   };
00035 };
00036 
00037 // Templates to choose Elf_Addr and Elf_Off depending on is64Bits.
00038 template <endianness target_endianness, std::size_t max_alignment>
00039 struct ELFDataTypeTypedefHelperCommon {
00040   typedef support::detail::packed_endian_specific_integral<
00041       uint16_t, target_endianness,
00042       MaximumAlignment<uint16_t, max_alignment>::value> Elf_Half;
00043   typedef support::detail::packed_endian_specific_integral<
00044       uint32_t, target_endianness,
00045       MaximumAlignment<uint32_t, max_alignment>::value> Elf_Word;
00046   typedef support::detail::packed_endian_specific_integral<
00047       int32_t, target_endianness,
00048       MaximumAlignment<int32_t, max_alignment>::value> Elf_Sword;
00049   typedef support::detail::packed_endian_specific_integral<
00050       uint64_t, target_endianness,
00051       MaximumAlignment<uint64_t, max_alignment>::value> Elf_Xword;
00052   typedef support::detail::packed_endian_specific_integral<
00053       int64_t, target_endianness,
00054       MaximumAlignment<int64_t, max_alignment>::value> Elf_Sxword;
00055 };
00056 
00057 template <class ELFT> struct ELFDataTypeTypedefHelper;
00058 
00059 /// ELF 32bit types.
00060 template <endianness TargetEndianness, std::size_t MaxAlign>
00061 struct ELFDataTypeTypedefHelper<ELFType<TargetEndianness, MaxAlign, false> >
00062     : ELFDataTypeTypedefHelperCommon<TargetEndianness, MaxAlign> {
00063   typedef uint32_t value_type;
00064   typedef support::detail::packed_endian_specific_integral<
00065       value_type, TargetEndianness,
00066       MaximumAlignment<value_type, MaxAlign>::value> Elf_Addr;
00067   typedef support::detail::packed_endian_specific_integral<
00068       value_type, TargetEndianness,
00069       MaximumAlignment<value_type, MaxAlign>::value> Elf_Off;
00070 };
00071 
00072 /// ELF 64bit types.
00073 template <endianness TargetEndianness, std::size_t MaxAlign>
00074 struct ELFDataTypeTypedefHelper<ELFType<TargetEndianness, MaxAlign, true> >
00075     : ELFDataTypeTypedefHelperCommon<TargetEndianness, MaxAlign> {
00076   typedef uint64_t value_type;
00077   typedef support::detail::packed_endian_specific_integral<
00078       value_type, TargetEndianness,
00079       MaximumAlignment<value_type, MaxAlign>::value> Elf_Addr;
00080   typedef support::detail::packed_endian_specific_integral<
00081       value_type, TargetEndianness,
00082       MaximumAlignment<value_type, MaxAlign>::value> Elf_Off;
00083 };
00084 
00085 // I really don't like doing this, but the alternative is copypasta.
00086 #define LLVM_ELF_IMPORT_TYPES(E, M, W)                                         \
00087 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Addr         \
00088     Elf_Addr;                                                                  \
00089 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Off          \
00090     Elf_Off;                                                                   \
00091 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Half         \
00092     Elf_Half;                                                                  \
00093 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Word         \
00094     Elf_Word;                                                                  \
00095 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Sword        \
00096     Elf_Sword;                                                                 \
00097 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Xword        \
00098     Elf_Xword;                                                                 \
00099 typedef typename ELFDataTypeTypedefHelper<ELFType<E, M, W> >::Elf_Sxword       \
00100     Elf_Sxword;
00101 
00102 #define LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)                                       \
00103   LLVM_ELF_IMPORT_TYPES(ELFT::TargetEndianness, ELFT::MaxAlignment,            \
00104                         ELFT::Is64Bits)
00105 
00106 // Section header.
00107 template <class ELFT> struct Elf_Shdr_Base;
00108 
00109 template <endianness TargetEndianness, std::size_t MaxAlign>
00110 struct Elf_Shdr_Base<ELFType<TargetEndianness, MaxAlign, false> > {
00111   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00112   Elf_Word sh_name;      // Section name (index into string table)
00113   Elf_Word sh_type;      // Section type (SHT_*)
00114   Elf_Word sh_flags;     // Section flags (SHF_*)
00115   Elf_Addr sh_addr;      // Address where section is to be loaded
00116   Elf_Off sh_offset;     // File offset of section data, in bytes
00117   Elf_Word sh_size;      // Size of section, in bytes
00118   Elf_Word sh_link;      // Section type-specific header table index link
00119   Elf_Word sh_info;      // Section type-specific extra information
00120   Elf_Word sh_addralign; // Section address alignment
00121   Elf_Word sh_entsize;   // Size of records contained within the section
00122 };
00123 
00124 template <endianness TargetEndianness, std::size_t MaxAlign>
00125 struct Elf_Shdr_Base<ELFType<TargetEndianness, MaxAlign, true> > {
00126   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00127   Elf_Word sh_name;       // Section name (index into string table)
00128   Elf_Word sh_type;       // Section type (SHT_*)
00129   Elf_Xword sh_flags;     // Section flags (SHF_*)
00130   Elf_Addr sh_addr;       // Address where section is to be loaded
00131   Elf_Off sh_offset;      // File offset of section data, in bytes
00132   Elf_Xword sh_size;      // Size of section, in bytes
00133   Elf_Word sh_link;       // Section type-specific header table index link
00134   Elf_Word sh_info;       // Section type-specific extra information
00135   Elf_Xword sh_addralign; // Section address alignment
00136   Elf_Xword sh_entsize;   // Size of records contained within the section
00137 };
00138 
00139 template <class ELFT>
00140 struct Elf_Shdr_Impl : Elf_Shdr_Base<ELFT> {
00141   using Elf_Shdr_Base<ELFT>::sh_entsize;
00142   using Elf_Shdr_Base<ELFT>::sh_size;
00143 
00144   /// @brief Get the number of entities this section contains if it has any.
00145   unsigned getEntityCount() const {
00146     if (sh_entsize == 0)
00147       return 0;
00148     return sh_size / sh_entsize;
00149   }
00150 };
00151 
00152 template <class ELFT> struct Elf_Sym_Base;
00153 
00154 template <endianness TargetEndianness, std::size_t MaxAlign>
00155 struct Elf_Sym_Base<ELFType<TargetEndianness, MaxAlign, false> > {
00156   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00157   Elf_Word st_name;       // Symbol name (index into string table)
00158   Elf_Addr st_value;      // Value or address associated with the symbol
00159   Elf_Word st_size;       // Size of the symbol
00160   unsigned char st_info;  // Symbol's type and binding attributes
00161   unsigned char st_other; // Must be zero; reserved
00162   Elf_Half st_shndx;      // Which section (header table index) it's defined in
00163 };
00164 
00165 template <endianness TargetEndianness, std::size_t MaxAlign>
00166 struct Elf_Sym_Base<ELFType<TargetEndianness, MaxAlign, true> > {
00167   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00168   Elf_Word st_name;       // Symbol name (index into string table)
00169   unsigned char st_info;  // Symbol's type and binding attributes
00170   unsigned char st_other; // Must be zero; reserved
00171   Elf_Half st_shndx;      // Which section (header table index) it's defined in
00172   Elf_Addr st_value;      // Value or address associated with the symbol
00173   Elf_Xword st_size;      // Size of the symbol
00174 };
00175 
00176 template <class ELFT>
00177 struct Elf_Sym_Impl : Elf_Sym_Base<ELFT> {
00178   using Elf_Sym_Base<ELFT>::st_info;
00179 
00180   // These accessors and mutators correspond to the ELF32_ST_BIND,
00181   // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
00182   unsigned char getBinding() const { return st_info >> 4; }
00183   unsigned char getType() const { return st_info & 0x0f; }
00184   void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
00185   void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
00186   void setBindingAndType(unsigned char b, unsigned char t) {
00187     st_info = (b << 4) + (t & 0x0f);
00188   }
00189 };
00190 
00191 /// Elf_Versym: This is the structure of entries in the SHT_GNU_versym section
00192 /// (.gnu.version). This structure is identical for ELF32 and ELF64.
00193 template <class ELFT>
00194 struct Elf_Versym_Impl {
00195   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00196   Elf_Half vs_index; // Version index with flags (e.g. VERSYM_HIDDEN)
00197 };
00198 
00199 template <class ELFT> struct Elf_Verdaux_Impl;
00200 
00201 /// Elf_Verdef: This is the structure of entries in the SHT_GNU_verdef section
00202 /// (.gnu.version_d). This structure is identical for ELF32 and ELF64.
00203 template <class ELFT>
00204 struct Elf_Verdef_Impl {
00205   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00206   typedef Elf_Verdaux_Impl<ELFT> Elf_Verdaux;
00207   Elf_Half vd_version; // Version of this structure (e.g. VER_DEF_CURRENT)
00208   Elf_Half vd_flags;   // Bitwise flags (VER_DEF_*)
00209   Elf_Half vd_ndx;     // Version index, used in .gnu.version entries
00210   Elf_Half vd_cnt;     // Number of Verdaux entries
00211   Elf_Word vd_hash;    // Hash of name
00212   Elf_Word vd_aux;     // Offset to the first Verdaux entry (in bytes)
00213   Elf_Word vd_next;    // Offset to the next Verdef entry (in bytes)
00214 
00215   /// Get the first Verdaux entry for this Verdef.
00216   const Elf_Verdaux *getAux() const {
00217     return reinterpret_cast<const Elf_Verdaux *>((const char *)this + vd_aux);
00218   }
00219 };
00220 
00221 /// Elf_Verdaux: This is the structure of auxiliary data in the SHT_GNU_verdef
00222 /// section (.gnu.version_d). This structure is identical for ELF32 and ELF64.
00223 template <class ELFT>
00224 struct Elf_Verdaux_Impl {
00225   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00226   Elf_Word vda_name; // Version name (offset in string table)
00227   Elf_Word vda_next; // Offset to next Verdaux entry (in bytes)
00228 };
00229 
00230 /// Elf_Verneed: This is the structure of entries in the SHT_GNU_verneed
00231 /// section (.gnu.version_r). This structure is identical for ELF32 and ELF64.
00232 template <class ELFT>
00233 struct Elf_Verneed_Impl {
00234   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00235   Elf_Half vn_version; // Version of this structure (e.g. VER_NEED_CURRENT)
00236   Elf_Half vn_cnt;     // Number of associated Vernaux entries
00237   Elf_Word vn_file;    // Library name (string table offset)
00238   Elf_Word vn_aux;     // Offset to first Vernaux entry (in bytes)
00239   Elf_Word vn_next;    // Offset to next Verneed entry (in bytes)
00240 };
00241 
00242 /// Elf_Vernaux: This is the structure of auxiliary data in SHT_GNU_verneed
00243 /// section (.gnu.version_r). This structure is identical for ELF32 and ELF64.
00244 template <class ELFT>
00245 struct Elf_Vernaux_Impl {
00246   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00247   Elf_Word vna_hash;  // Hash of dependency name
00248   Elf_Half vna_flags; // Bitwise Flags (VER_FLAG_*)
00249   Elf_Half vna_other; // Version index, used in .gnu.version entries
00250   Elf_Word vna_name;  // Dependency name
00251   Elf_Word vna_next;  // Offset to next Vernaux entry (in bytes)
00252 };
00253 
00254 /// Elf_Dyn_Base: This structure matches the form of entries in the dynamic
00255 ///               table section (.dynamic) look like.
00256 template <class ELFT> struct Elf_Dyn_Base;
00257 
00258 template <endianness TargetEndianness, std::size_t MaxAlign>
00259 struct Elf_Dyn_Base<ELFType<TargetEndianness, MaxAlign, false> > {
00260   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00261   Elf_Sword d_tag;
00262   union {
00263     Elf_Word d_val;
00264     Elf_Addr d_ptr;
00265   } d_un;
00266 };
00267 
00268 template <endianness TargetEndianness, std::size_t MaxAlign>
00269 struct Elf_Dyn_Base<ELFType<TargetEndianness, MaxAlign, true> > {
00270   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00271   Elf_Sxword d_tag;
00272   union {
00273     Elf_Xword d_val;
00274     Elf_Addr d_ptr;
00275   } d_un;
00276 };
00277 
00278 /// Elf_Dyn_Impl: This inherits from Elf_Dyn_Base, adding getters and setters.
00279 template <class ELFT>
00280 struct Elf_Dyn_Impl : Elf_Dyn_Base<ELFT> {
00281   using Elf_Dyn_Base<ELFT>::d_tag;
00282   using Elf_Dyn_Base<ELFT>::d_un;
00283   int64_t getTag() const { return d_tag; }
00284   uint64_t getVal() const { return d_un.d_val; }
00285   uint64_t getPtr() const { return d_un.ptr; }
00286 };
00287 
00288 // Elf_Rel: Elf Relocation
00289 template <class ELFT, bool isRela> struct Elf_Rel_Base;
00290 
00291 template <endianness TargetEndianness, std::size_t MaxAlign>
00292 struct Elf_Rel_Base<ELFType<TargetEndianness, MaxAlign, false>, false> {
00293   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00294   Elf_Addr r_offset; // Location (file byte offset, or program virtual addr)
00295   Elf_Word r_info;   // Symbol table index and type of relocation to apply
00296 
00297   uint32_t getRInfo(bool isMips64EL) const {
00298     assert(!isMips64EL);
00299     return r_info;
00300   }
00301   void setRInfo(uint32_t R) { r_info = R; }
00302 };
00303 
00304 template <endianness TargetEndianness, std::size_t MaxAlign>
00305 struct Elf_Rel_Base<ELFType<TargetEndianness, MaxAlign, true>, false> {
00306   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00307   Elf_Addr r_offset; // Location (file byte offset, or program virtual addr)
00308   Elf_Xword r_info;  // Symbol table index and type of relocation to apply
00309 
00310   uint64_t getRInfo(bool isMips64EL) const {
00311     uint64_t t = r_info;
00312     if (!isMips64EL)
00313       return t;
00314     // Mips64 little endian has a "special" encoding of r_info. Instead of one
00315     // 64 bit little endian number, it is a little endian 32 bit number followed
00316     // by a 32 bit big endian number.
00317     return (t << 32) | ((t >> 8) & 0xff000000) | ((t >> 24) & 0x00ff0000) |
00318            ((t >> 40) & 0x0000ff00) | ((t >> 56) & 0x000000ff);
00319   }
00320   void setRInfo(uint64_t R) {
00321     // FIXME: Add mips64el support.
00322     r_info = R;
00323   }
00324 };
00325 
00326 template <endianness TargetEndianness, std::size_t MaxAlign>
00327 struct Elf_Rel_Base<ELFType<TargetEndianness, MaxAlign, false>, true> {
00328   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00329   Elf_Addr r_offset;  // Location (file byte offset, or program virtual addr)
00330   Elf_Word r_info;    // Symbol table index and type of relocation to apply
00331   Elf_Sword r_addend; // Compute value for relocatable field by adding this
00332 
00333   uint32_t getRInfo(bool isMips64EL) const {
00334     assert(!isMips64EL);
00335     return r_info;
00336   }
00337   void setRInfo(uint32_t R) { r_info = R; }
00338 };
00339 
00340 template <endianness TargetEndianness, std::size_t MaxAlign>
00341 struct Elf_Rel_Base<ELFType<TargetEndianness, MaxAlign, true>, true> {
00342   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00343   Elf_Addr r_offset;   // Location (file byte offset, or program virtual addr)
00344   Elf_Xword r_info;    // Symbol table index and type of relocation to apply
00345   Elf_Sxword r_addend; // Compute value for relocatable field by adding this.
00346 
00347   uint64_t getRInfo(bool isMips64EL) const {
00348     // Mips64 little endian has a "special" encoding of r_info. Instead of one
00349     // 64 bit little endian number, it is a little endian 32 bit number followed
00350     // by a 32 bit big endian number.
00351     uint64_t t = r_info;
00352     if (!isMips64EL)
00353       return t;
00354     return (t << 32) | ((t >> 8) & 0xff000000) | ((t >> 24) & 0x00ff0000) |
00355            ((t >> 40) & 0x0000ff00) | ((t >> 56) & 0x000000ff);
00356   }
00357   void setRInfo(uint64_t R) {
00358     // FIXME: Add mips64el support.
00359     r_info = R;
00360   }
00361 };
00362 
00363 template <class ELFT, bool isRela> struct Elf_Rel_Impl;
00364 
00365 template <endianness TargetEndianness, std::size_t MaxAlign, bool isRela>
00366 struct Elf_Rel_Impl<ELFType<TargetEndianness, MaxAlign, true>,
00367                     isRela> : Elf_Rel_Base<
00368     ELFType<TargetEndianness, MaxAlign, true>, isRela> {
00369   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00370 
00371   // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
00372   // and ELF64_R_INFO macros defined in the ELF specification:
00373   uint32_t getSymbol(bool isMips64EL) const {
00374     return (uint32_t)(this->getRInfo(isMips64EL) >> 32);
00375   }
00376   uint32_t getType(bool isMips64EL) const {
00377     return (uint32_t)(this->getRInfo(isMips64EL) & 0xffffffffL);
00378   }
00379   void setSymbol(uint32_t s) { setSymbolAndType(s, getType()); }
00380   void setType(uint32_t t) { setSymbolAndType(getSymbol(), t); }
00381   void setSymbolAndType(uint32_t s, uint32_t t) {
00382     this->setRInfo(((uint64_t)s << 32) + (t & 0xffffffffL));
00383   }
00384 };
00385 
00386 template <endianness TargetEndianness, std::size_t MaxAlign, bool isRela>
00387 struct Elf_Rel_Impl<ELFType<TargetEndianness, MaxAlign, false>,
00388                     isRela> : Elf_Rel_Base<
00389     ELFType<TargetEndianness, MaxAlign, false>, isRela> {
00390   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00391 
00392   // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
00393   // and ELF32_R_INFO macros defined in the ELF specification:
00394   uint32_t getSymbol(bool isMips64EL) const {
00395     return this->getRInfo(isMips64EL) >> 8;
00396   }
00397   unsigned char getType(bool isMips64EL) const {
00398     return (unsigned char)(this->getRInfo(isMips64EL) & 0x0ff);
00399   }
00400   void setSymbol(uint32_t s) { setSymbolAndType(s, getType()); }
00401   void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
00402   void setSymbolAndType(uint32_t s, unsigned char t) {
00403     this->setRInfo((s << 8) + t);
00404   }
00405 };
00406 
00407 template <class ELFT>
00408 struct Elf_Ehdr_Impl {
00409   LLVM_ELF_IMPORT_TYPES_ELFT(ELFT)
00410   unsigned char e_ident[ELF::EI_NIDENT]; // ELF Identification bytes
00411   Elf_Half e_type;                       // Type of file (see ET_*)
00412   Elf_Half e_machine;   // Required architecture for this file (see EM_*)
00413   Elf_Word e_version;   // Must be equal to 1
00414   Elf_Addr e_entry;     // Address to jump to in order to start program
00415   Elf_Off e_phoff;      // Program header table's file offset, in bytes
00416   Elf_Off e_shoff;      // Section header table's file offset, in bytes
00417   Elf_Word e_flags;     // Processor-specific flags
00418   Elf_Half e_ehsize;    // Size of ELF header, in bytes
00419   Elf_Half e_phentsize; // Size of an entry in the program header table
00420   Elf_Half e_phnum;     // Number of entries in the program header table
00421   Elf_Half e_shentsize; // Size of an entry in the section header table
00422   Elf_Half e_shnum;     // Number of entries in the section header table
00423   Elf_Half e_shstrndx;  // Section header table index of section name
00424                         // string table
00425   bool checkMagic() const {
00426     return (memcmp(e_ident, ELF::ElfMagic, strlen(ELF::ElfMagic))) == 0;
00427   }
00428   unsigned char getFileClass() const { return e_ident[ELF::EI_CLASS]; }
00429   unsigned char getDataEncoding() const { return e_ident[ELF::EI_DATA]; }
00430 };
00431 
00432 template <class ELFT> struct Elf_Phdr_Impl;
00433 
00434 template <endianness TargetEndianness, std::size_t MaxAlign>
00435 struct Elf_Phdr_Impl<ELFType<TargetEndianness, MaxAlign, false> > {
00436   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, false)
00437   Elf_Word p_type;   // Type of segment
00438   Elf_Off p_offset;  // FileOffset where segment is located, in bytes
00439   Elf_Addr p_vaddr;  // Virtual Address of beginning of segment
00440   Elf_Addr p_paddr;  // Physical address of beginning of segment (OS-specific)
00441   Elf_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
00442   Elf_Word p_memsz;  // Num. of bytes in mem image of segment (may be zero)
00443   Elf_Word p_flags;  // Segment flags
00444   Elf_Word p_align;  // Segment alignment constraint
00445 };
00446 
00447 template <endianness TargetEndianness, std::size_t MaxAlign>
00448 struct Elf_Phdr_Impl<ELFType<TargetEndianness, MaxAlign, true> > {
00449   LLVM_ELF_IMPORT_TYPES(TargetEndianness, MaxAlign, true)
00450   Elf_Word p_type;    // Type of segment
00451   Elf_Word p_flags;   // Segment flags
00452   Elf_Off p_offset;   // FileOffset where segment is located, in bytes
00453   Elf_Addr p_vaddr;   // Virtual Address of beginning of segment
00454   Elf_Addr p_paddr;   // Physical address of beginning of segment (OS-specific)
00455   Elf_Xword p_filesz; // Num. of bytes in file image of segment (may be zero)
00456   Elf_Xword p_memsz;  // Num. of bytes in mem image of segment (may be zero)
00457   Elf_Xword p_align;  // Segment alignment constraint
00458 };
00459 
00460 } // end namespace object.
00461 } // end namespace llvm.
00462 
00463 #endif