mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-17 06:33:21 +00:00
[Object] Extract Elf_Ehdr. Patch by Hemant Kulkarni!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@163532 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
6165dba25f
commit
2c38a6615a
@ -387,26 +387,9 @@ struct Elf_Rel_Impl<target_endianness, false, isRela>
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
template<support::endianness target_endianness, bool is64Bits>
|
template<support::endianness target_endianness, bool is64Bits>
|
||||||
class ELFObjectFile : public ObjectFile {
|
struct Elf_Ehdr_Impl {
|
||||||
LLVM_ELF_IMPORT_TYPES(target_endianness, is64Bits)
|
LLVM_ELF_IMPORT_TYPES(target_endianness, is64Bits)
|
||||||
|
|
||||||
typedef Elf_Shdr_Impl<target_endianness, is64Bits> Elf_Shdr;
|
|
||||||
typedef Elf_Sym_Impl<target_endianness, is64Bits> Elf_Sym;
|
|
||||||
typedef Elf_Dyn_Impl<target_endianness, is64Bits> Elf_Dyn;
|
|
||||||
typedef Elf_Rel_Impl<target_endianness, is64Bits, false> Elf_Rel;
|
|
||||||
typedef Elf_Rel_Impl<target_endianness, is64Bits, true> Elf_Rela;
|
|
||||||
typedef Elf_Verdef_Impl<target_endianness, is64Bits> Elf_Verdef;
|
|
||||||
typedef Elf_Verdaux_Impl<target_endianness, is64Bits> Elf_Verdaux;
|
|
||||||
typedef Elf_Verneed_Impl<target_endianness, is64Bits> Elf_Verneed;
|
|
||||||
typedef Elf_Vernaux_Impl<target_endianness, is64Bits> Elf_Vernaux;
|
|
||||||
typedef Elf_Versym_Impl<target_endianness, is64Bits> Elf_Versym;
|
|
||||||
typedef DynRefImpl<target_endianness, is64Bits> DynRef;
|
|
||||||
typedef content_iterator<DynRef> dyn_iterator;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
struct Elf_Ehdr {
|
|
||||||
unsigned char e_ident[ELF::EI_NIDENT]; // ELF Identification bytes
|
unsigned char e_ident[ELF::EI_NIDENT]; // ELF Identification bytes
|
||||||
Elf_Half e_type; // Type of file (see ET_*)
|
Elf_Half e_type; // Type of file (see ET_*)
|
||||||
Elf_Half e_machine; // Required architecture for this file (see EM_*)
|
Elf_Half e_machine; // Required architecture for this file (see EM_*)
|
||||||
@ -428,6 +411,26 @@ protected:
|
|||||||
unsigned char getFileClass() const { return e_ident[ELF::EI_CLASS]; }
|
unsigned char getFileClass() const { return e_ident[ELF::EI_CLASS]; }
|
||||||
unsigned char getDataEncoding() const { return e_ident[ELF::EI_DATA]; }
|
unsigned char getDataEncoding() const { return e_ident[ELF::EI_DATA]; }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<support::endianness target_endianness, bool is64Bits>
|
||||||
|
class ELFObjectFile : public ObjectFile {
|
||||||
|
LLVM_ELF_IMPORT_TYPES(target_endianness, is64Bits)
|
||||||
|
|
||||||
|
typedef Elf_Ehdr_Impl<target_endianness, is64Bits> Elf_Ehdr;
|
||||||
|
typedef Elf_Shdr_Impl<target_endianness, is64Bits> Elf_Shdr;
|
||||||
|
typedef Elf_Sym_Impl<target_endianness, is64Bits> Elf_Sym;
|
||||||
|
typedef Elf_Dyn_Impl<target_endianness, is64Bits> Elf_Dyn;
|
||||||
|
typedef Elf_Rel_Impl<target_endianness, is64Bits, false> Elf_Rel;
|
||||||
|
typedef Elf_Rel_Impl<target_endianness, is64Bits, true> Elf_Rela;
|
||||||
|
typedef Elf_Verdef_Impl<target_endianness, is64Bits> Elf_Verdef;
|
||||||
|
typedef Elf_Verdaux_Impl<target_endianness, is64Bits> Elf_Verdaux;
|
||||||
|
typedef Elf_Verneed_Impl<target_endianness, is64Bits> Elf_Verneed;
|
||||||
|
typedef Elf_Vernaux_Impl<target_endianness, is64Bits> Elf_Vernaux;
|
||||||
|
typedef Elf_Versym_Impl<target_endianness, is64Bits> Elf_Versym;
|
||||||
|
typedef DynRefImpl<target_endianness, is64Bits> DynRef;
|
||||||
|
typedef content_iterator<DynRef> dyn_iterator;
|
||||||
|
|
||||||
|
protected:
|
||||||
// This flag is used for classof, to distinguish ELFObjectFile from
|
// This flag is used for classof, to distinguish ELFObjectFile from
|
||||||
// its subclass. If more subclasses will be created, this flag will
|
// its subclass. If more subclasses will be created, this flag will
|
||||||
// have to become an enum.
|
// have to become an enum.
|
||||||
|
@ -36,8 +36,7 @@ class DyldELFObject : public ELFObjectFile<target_endianness, is64Bits> {
|
|||||||
typedef Elf_Rel_Impl<target_endianness, is64Bits, false> Elf_Rel;
|
typedef Elf_Rel_Impl<target_endianness, is64Bits, false> Elf_Rel;
|
||||||
typedef Elf_Rel_Impl<target_endianness, is64Bits, true> Elf_Rela;
|
typedef Elf_Rel_Impl<target_endianness, is64Bits, true> Elf_Rela;
|
||||||
|
|
||||||
typedef typename ELFObjectFile<target_endianness, is64Bits>::
|
typedef Elf_Ehdr_Impl<target_endianness, is64Bits> Elf_Ehdr;
|
||||||
Elf_Ehdr Elf_Ehdr;
|
|
||||||
|
|
||||||
typedef typename ELFDataTypeTypedefHelper<
|
typedef typename ELFDataTypeTypedefHelper<
|
||||||
target_endianness, is64Bits>::value_type addr_type;
|
target_endianness, is64Bits>::value_type addr_type;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user