[U-Boot] [PATCH v2 08/18] elf: Add ELF64 related structure defines
Bin Meng
bmeng.cn at gmail.com
Thu Apr 12 05:02:13 UTC 2018
This adds ELF header, program header and section header structure
defines for the 64-bit ELF image.
Signed-off-by: Bin Meng <bmeng.cn at gmail.com>
---
Changes in v2: None
include/elf.h | 43 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)
diff --git a/include/elf.h b/include/elf.h
index 4742597..248ba59 100644
--- a/include/elf.h
+++ b/include/elf.h
@@ -107,6 +107,24 @@ typedef struct {
header string table" entry offset */
} Elf32_Ehdr;
+typedef struct {
+ unsigned char e_ident[EI_NIDENT]; /* ELF Identification */
+ Elf64_Half e_type; /* object file type */
+ Elf64_Half e_machine; /* machine */
+ Elf64_Word e_version; /* object file version */
+ Elf64_Addr e_entry; /* virtual entry point */
+ Elf64_Off e_phoff; /* program header table offset */
+ Elf64_Off e_shoff; /* section header table offset */
+ Elf64_Word e_flags; /* processor-specific flags */
+ Elf64_Half e_ehsize; /* ELF header size */
+ Elf64_Half e_phentsize; /* program header entry size */
+ Elf64_Half e_phnum; /* number of program header entries */
+ Elf64_Half e_shentsize; /* section header entry size */
+ Elf64_Half e_shnum; /* number of section header entries */
+ Elf64_Half e_shstrndx; /* section header table's "section
+ header string table" entry offset */
+} Elf64_Ehdr;
+
/* e_type */
#define ET_NONE 0 /* No file type */
#define ET_REL 1 /* relocatable file */
@@ -224,6 +242,20 @@ typedef struct {
Elf32_Word sh_entsize; /* section entry size */
} Elf32_Shdr;
+typedef struct {
+ Elf64_Word sh_name; /* name - index into section header
+ string table section */
+ Elf64_Word sh_type; /* type */
+ Elf64_Xword sh_flags; /* flags */
+ Elf64_Addr sh_addr; /* address */
+ Elf64_Off sh_offset; /* file offset */
+ Elf64_Xword sh_size; /* section size */
+ Elf64_Word sh_link; /* section header table index link */
+ Elf64_Word sh_info; /* extra information */
+ Elf64_Xword sh_addralign; /* address alignment */
+ Elf64_Xword sh_entsize; /* section entry size */
+} Elf64_Shdr;
+
/* Special Section Indexes */
#define SHN_UNDEF 0 /* undefined */
#define SHN_LORESERVE 0xff00 /* lower bounds of reserved indexes */
@@ -408,6 +440,17 @@ typedef struct {
Elf32_Word p_align; /* memory alignment */
} Elf32_Phdr;
+typedef struct {
+ Elf64_Word p_type; /* segment type */
+ Elf64_Word p_flags; /* flags */
+ Elf64_Off p_offset; /* segment offset */
+ Elf64_Addr p_vaddr; /* virtual address of segment */
+ Elf64_Addr p_paddr; /* physical address of segment */
+ Elf64_Xword p_filesz; /* number of bytes in file for seg */
+ Elf64_Xword p_memsz; /* number of bytes in mem. for seg */
+ Elf64_Xword p_align; /* memory alignment */
+} Elf64_Phdr;
+
/* Segment types - p_type */
#define PT_NULL 0 /* unused */
#define PT_LOAD 1 /* loadable segment */
--
2.7.4
More information about the U-Boot
mailing list