]> git.lizzy.rs Git - plan9front.git/blobdiff - sys/src/libmach/elf.h
merge
[plan9front.git] / sys / src / libmach / elf.h
index 5d755b7a6f3cc5f5423a65b713a521e9abd46437..94fa7331c3aa6f0c143dd17177b6e2a900609f9c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *     Definitions needed for  accessing Irix ELF headers
+ *     Definitions needed for accessing ELF headers
  */
 typedef struct {
        uchar   ident[16];      /* ident bytes */
@@ -18,6 +18,23 @@ typedef struct {
        ushort  shstrndx;       /* shdr string index */
 } Ehdr;
 
+typedef struct {
+       u8int   ident[16];      /* ident bytes */
+       u16int  type;           /* file type */
+       u16int  machine;        /* target machine */
+       u32int  version;        /* file version */
+       u64int  elfentry;       /* start address */
+       u64int  phoff;          /* phdr file offset */
+       u64int  shoff;          /* shdr file offset */
+       u32int  flags;          /* file flags */
+       u16int  ehsize;         /* sizeof ehdr */
+       u16int  phentsize;      /* sizeof phdr */
+       u16int  phnum;          /* number phdrs */
+       u16int  shentsize;      /* sizeof shdr */
+       u16int  shnum;          /* number shdrs */
+       u16int  shstrndx;       /* shdr string index */
+} E64hdr;
+
 typedef struct {
        int     type;           /* entry type */
        ulong   offset;         /* file offset */
@@ -29,6 +46,17 @@ typedef struct {
        int     align;          /* memory/file alignment */
 } Phdr;
 
+typedef struct {
+       u32int  type;           /* entry type */
+       u32int  flags;          /* entry flags */
+       u64int  offset;         /* file offset */
+       u64int  vaddr;          /* virtual address */
+       u64int  paddr;          /* physical address */
+       u64int  filesz;         /* file size */
+       u64int  memsz;          /* memory size */
+       u64int  align;          /* memory/file alignment */
+} P64hdr;
+
 typedef struct {
        ulong   name;           /* section name */
        ulong   type;           /* SHT_... */
@@ -42,6 +70,19 @@ typedef struct {
        ulong   entsize;        /* entry size if table */
 } Shdr;
 
+typedef struct {
+       u32int  name;           /* section name */
+       u32int  type;           /* SHT_... */
+       u64int  flags;          /* SHF_... */
+       u64int  addr;           /* virtual address */
+       u64int  offset;         /* file offset */
+       u64int  size;           /* section size */
+       u32int  link;           /* misc info */
+       u32int  info;           /* misc info */
+       u64int  addralign;      /* memory alignment */
+       u64int  entsize;        /* entry size if table */
+} S64hdr;
+
 enum {
        /* Ehdr codes */
        MAG0 = 0,               /* ident[] indexes */
@@ -80,8 +121,10 @@ enum {
        S370 = 9,               /* Amdhal       */
        SPARC64 = 18,           /* Sun SPARC v9 */
        POWER = 20,             /* PowerPC */
-       ARM = 40,                       /* ARM */
+       POWER64 = 21,           /* PowerPC64 */
+       ARM = 40,               /* ARM */
        AMD64 = 62,             /* Amd64 */
+       ARM64 = 183,            /* ARM64 */
 
        NO_VERSION = 0,         /* version, ident[VERSION] */
        CURRENT = 1,