xhost + # Workaround for: QXcbConnection: Could not connect to display :0
[appimagekit.git] / light_elf.h
blob7b81b480d2f09ce6ff65ef066d945c5ea6c1e717
1 /*
2 *
3 * Linux kernel
4 * Copyright (C) 2017 Linus Torvalds
5 * Modified work Copyright (C) 2017 @teras (https://github.com/teras)
6 * (Shortened version -- original work found here:
7 * https://github.com/torvalds/linux/blob/master/include/uapi/linux/elf.h)
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
24 #ifndef _ELF_H
25 #define _ELF_H 1
27 #include <inttypes.h>
29 __BEGIN_DECLS
31 typedef uint16_t Elf32_Half;
32 typedef uint16_t Elf64_Half;
33 typedef uint32_t Elf32_Word;
34 typedef uint32_t Elf64_Word;
35 typedef uint64_t Elf64_Xword;
36 typedef uint32_t Elf32_Addr;
37 typedef uint64_t Elf64_Addr;
38 typedef uint32_t Elf32_Off;
39 typedef uint64_t Elf64_Off;
41 #define EI_NIDENT 16
43 typedef struct elf32_hdr {
44 unsigned char e_ident[EI_NIDENT];
45 Elf32_Half e_type;
46 Elf32_Half e_machine;
47 Elf32_Word e_version;
48 Elf32_Addr e_entry; /* Entry point */
49 Elf32_Off e_phoff;
50 Elf32_Off e_shoff;
51 Elf32_Word e_flags;
52 Elf32_Half e_ehsize;
53 Elf32_Half e_phentsize;
54 Elf32_Half e_phnum;
55 Elf32_Half e_shentsize;
56 Elf32_Half e_shnum;
57 Elf32_Half e_shstrndx;
58 } Elf32_Ehdr;
60 typedef struct elf64_hdr {
61 unsigned char e_ident[EI_NIDENT]; /* ELF "magic number" */
62 Elf64_Half e_type;
63 Elf64_Half e_machine;
64 Elf64_Word e_version;
65 Elf64_Addr e_entry; /* Entry point virtual address */
66 Elf64_Off e_phoff; /* Program header table file offset */
67 Elf64_Off e_shoff; /* Section header table file offset */
68 Elf64_Word e_flags;
69 Elf64_Half e_ehsize;
70 Elf64_Half e_phentsize;
71 Elf64_Half e_phnum;
72 Elf64_Half e_shentsize;
73 Elf64_Half e_shnum;
74 Elf64_Half e_shstrndx;
75 } Elf64_Ehdr;
77 typedef struct elf32_shdr {
78 Elf32_Word sh_name;
79 Elf32_Word sh_type;
80 Elf32_Word sh_flags;
81 Elf32_Addr sh_addr;
82 Elf32_Off sh_offset;
83 Elf32_Word sh_size;
84 Elf32_Word sh_link;
85 Elf32_Word sh_info;
86 Elf32_Word sh_addralign;
87 Elf32_Word sh_entsize;
88 } Elf32_Shdr;
90 typedef struct elf64_shdr {
91 Elf64_Word sh_name; /* Section name, index in string tbl */
92 Elf64_Word sh_type; /* Type of section */
93 Elf64_Xword sh_flags; /* Miscellaneous section attributes */
94 Elf64_Addr sh_addr; /* Section virtual addr at execution */
95 Elf64_Off sh_offset; /* Section file offset */
96 Elf64_Xword sh_size; /* Size of section in bytes */
97 Elf64_Word sh_link; /* Index of another section */
98 Elf64_Word sh_info; /* Additional section information */
99 Elf64_Xword sh_addralign; /* Section alignment */
100 Elf64_Xword sh_entsize; /* Entry size if section holds table */
101 } Elf64_Shdr;
103 /* Note header in a PT_NOTE section */
104 typedef struct elf32_note {
105 Elf32_Word n_namesz; /* Name size */
106 Elf32_Word n_descsz; /* Content size */
107 Elf32_Word n_type; /* Content type */
108 } Elf32_Nhdr;
110 #define ELFCLASS32 1
111 #define ELFDATA2LSB 1
112 #define ELFDATA2MSB 2
113 #define ELFCLASS64 2
114 #define EI_CLASS 4
115 #define EI_DATA 5
117 __END_DECLS
119 #endif /* elf.h */