Elf_LE32_Shdr; set_native16()
p_elf.h p_unix.h committer: jreiser <jreiser> 1042341777 +0000
This commit is contained in:
parent
5e5ea9f6e4
commit
73dc4eede0
47
src/p_elf.h
47
src/p_elf.h
@ -82,6 +82,53 @@ struct Elf_LE32_Phdr
|
||||
__attribute_packed;
|
||||
|
||||
|
||||
struct Elf_LE32_Shdr
|
||||
{
|
||||
LE32 sh_name; /* Section name (string tbl index) */
|
||||
LE32 sh_type; /* Section type */
|
||||
LE32 sh_flags; /* Section flags */
|
||||
LE32 sh_addr; /* Section virtual addr at execution */
|
||||
LE32 sh_offset; /* Section file offset */
|
||||
LE32 sh_size; /* Section size in bytes */
|
||||
LE32 sh_link; /* Link to another section */
|
||||
LE32 sh_info; /* Additional section information */
|
||||
LE32 sh_addralign; /* Section alignment */
|
||||
LE32 sh_entsize; /* Entry size if section holds table */
|
||||
|
||||
enum { // values for sh_type
|
||||
SHT_NULL = 0, /* Section header table entry unused */
|
||||
SHT_PROGBITS = 1,/* Program data */
|
||||
SHT_SYMTAB = 2, /* Symbol table */
|
||||
SHT_STRTAB = 3, /* String table */
|
||||
SHT_RELA = 4, /* Relocation entries with addends */
|
||||
SHT_HASH = 5, /* Symbol hash table */
|
||||
SHT_DYNAMIC = 6, /* Dynamic linking information */
|
||||
SHT_NOTE = 7, /* Notes */
|
||||
SHT_NOBITS = 8, /* Program space with no data (bss) */
|
||||
SHT_REL = 9, /* Relocation entries, no addends */
|
||||
SHT_SHLIB = 10, /* Reserved */
|
||||
SHT_DYNSYM = 11, /* Dynamic linker symbol table */
|
||||
/* 12, 13 hole */
|
||||
SHT_INIT_ARRAY = 14, /* Array of constructors */
|
||||
SHT_FINI_ARRAY = 15, /* Array of destructors */
|
||||
SHT_PREINIT_ARRAY = 16, /* Array of pre-constructors */
|
||||
SHT_GROUP = 17, /* Section group */
|
||||
SHT_SYMTAB_SHNDX = 18, /* Extended section indeces */
|
||||
SHT_NUM = 19 /* Number of defined types. */
|
||||
};
|
||||
|
||||
enum { // values for sh_flags
|
||||
SHF_WRITE = (1 << 0), /* Writable */
|
||||
SHF_ALLOC = (1 << 1), /* Occupies memory during execution */
|
||||
SHF_EXECINSTR = (1 << 2), /* Executable */
|
||||
SHF_MERGE = (1 << 4), /* Might be merged */
|
||||
SHF_STRINGS = (1 << 5), /* Contains nul-terminated strings */
|
||||
SHF_INFO_LINK = (1 << 6), /* `sh_info' contains SHT index */
|
||||
SHF_LINK_ORDER = (1 << 7), /* Preserve order after combining */
|
||||
};
|
||||
}
|
||||
__attribute_packed;
|
||||
|
||||
struct Elf_LE32_Dyn
|
||||
{
|
||||
LE32 d_tag;
|
||||
|
||||
@ -68,6 +68,7 @@ protected:
|
||||
// an endian abstraction here
|
||||
virtual unsigned get_native32(const void *) = 0;
|
||||
virtual void set_native32(void *, unsigned) = 0;
|
||||
virtual void set_native16(void *, unsigned) = 0;
|
||||
|
||||
virtual bool checkCompressionRatio(unsigned, unsigned) const;
|
||||
|
||||
@ -133,6 +134,10 @@ protected:
|
||||
{
|
||||
set_be32(b, v);
|
||||
}
|
||||
virtual void set_native16(void *b, unsigned v)
|
||||
{
|
||||
set_be16(b, v);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -149,6 +154,10 @@ protected:
|
||||
{
|
||||
set_le32(b, v);
|
||||
}
|
||||
virtual void set_native16(void *b, unsigned v)
|
||||
{
|
||||
set_le16(b, v);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user