]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
elf: Add ELF64 related structure defines
authorBin Meng <bmeng.cn@gmail.com>
Thu, 12 Apr 2018 05:02:13 +0000 (22:02 -0700)
committerBin Meng <bmeng.cn@gmail.com>
Mon, 16 Apr 2018 08:54:51 +0000 (16:54 +0800)
This adds ELF header, program header and section header structure
defines for the 64-bit ELF image.

Signed-off-by: Bin Meng <bmeng.cn@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
include/elf.h

index 4742597980799ee3b333d77208cf5231d540d040..248ba59cd6afceb5e4452c56522aef6c868804c2 100644 (file)
@@ -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 */