diff options
| author | 2014-06-17 06:23:46 -0400 | |
|---|---|---|
| committer | 2014-06-17 06:23:46 -0400 | |
| commit | c144ed5058e144311c5919ba8b64105811736bed (patch) | |
| tree | bc2ff26ae013af71f82b0b78c3c0e63af0fec70e /src | |
| parent | Loader: Cleaned up and removed unused code, refactored ELF namespace. (diff) | |
| download | yuzu-c144ed5058e144311c5919ba8b64105811736bed.tar.gz yuzu-c144ed5058e144311c5919ba8b64105811736bed.tar.xz yuzu-c144ed5058e144311c5919ba8b64105811736bed.zip | |
Elf: Removed unused macros, changed #include of "common.h" to just "common_types.h".
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/loader/elf.h | 118 |
1 files changed, 1 insertions, 117 deletions
diff --git a/src/core/loader/elf.h b/src/core/loader/elf.h index 708281478..24d2f91be 100644 --- a/src/core/loader/elf.h +++ b/src/core/loader/elf.h | |||
| @@ -4,7 +4,7 @@ | |||
| 4 | 4 | ||
| 5 | #pragma once | 5 | #pragma once |
| 6 | 6 | ||
| 7 | #include "common/common.h" | 7 | #include "common/common_types.h" |
| 8 | 8 | ||
| 9 | // ELF Header Constants | 9 | // ELF Header Constants |
| 10 | 10 | ||
| @@ -52,27 +52,8 @@ enum ElfMachine { | |||
| 52 | #define ELFMAG2 'L' | 52 | #define ELFMAG2 'L' |
| 53 | #define ELFMAG3 'F' | 53 | #define ELFMAG3 'F' |
| 54 | 54 | ||
| 55 | // File class | ||
| 56 | #define ELFCLASSNONE 0 | ||
| 57 | #define ELFCLASS32 1 | ||
| 58 | #define ELFCLASS64 2 | ||
| 59 | |||
| 60 | // Encoding | ||
| 61 | #define ELFDATANONE 0 | ||
| 62 | #define ELFDATA2LSB 1 | ||
| 63 | #define ELFDATA2MSB 2 | ||
| 64 | |||
| 65 | // Sections constants | 55 | // Sections constants |
| 66 | 56 | ||
| 67 | // Section indexes | ||
| 68 | #define SHN_UNDEF 0 | ||
| 69 | #define SHN_LORESERVE 0xFF00 | ||
| 70 | #define SHN_LOPROC 0xFF00 | ||
| 71 | #define SHN_HIPROC 0xFF1F | ||
| 72 | #define SHN_ABS 0xFFF1 | ||
| 73 | #define SHN_COMMON 0xFFF2 | ||
| 74 | #define SHN_HIRESERVE 0xFFFF | ||
| 75 | |||
| 76 | // Section types | 57 | // Section types |
| 77 | #define SHT_NULL 0 | 58 | #define SHT_NULL 0 |
| 78 | #define SHT_PROGBITS 1 | 59 | #define SHT_PROGBITS 1 |
| @@ -91,9 +72,6 @@ enum ElfMachine { | |||
| 91 | #define SHT_LOUSER 0x80000000 | 72 | #define SHT_LOUSER 0x80000000 |
| 92 | #define SHT_HIUSER 0xFFFFFFFF | 73 | #define SHT_HIUSER 0xFFFFFFFF |
| 93 | 74 | ||
| 94 | // Custom section types | ||
| 95 | #define SHT_PSPREL 0x700000a0 | ||
| 96 | |||
| 97 | // Section flags | 75 | // Section flags |
| 98 | enum ElfSectionFlags | 76 | enum ElfSectionFlags |
| 99 | { | 77 | { |
| @@ -103,38 +81,6 @@ enum ElfSectionFlags | |||
| 103 | SHF_MASKPROC = 0xF0000000, | 81 | SHF_MASKPROC = 0xF0000000, |
| 104 | }; | 82 | }; |
| 105 | 83 | ||
| 106 | // Symbol binding | ||
| 107 | #define STB_LOCAL 0 | ||
| 108 | #define STB_GLOBAL 1 | ||
| 109 | #define STB_WEAK 2 | ||
| 110 | #define STB_LOPROC 13 | ||
| 111 | #define STB_HIPROC 15 | ||
| 112 | |||
| 113 | // Symbol types | ||
| 114 | #define STT_NOTYPE 0 | ||
| 115 | #define STT_OBJECT 1 | ||
| 116 | #define STT_FUNC 2 | ||
| 117 | #define STT_SECTION 3 | ||
| 118 | #define STT_FILE 4 | ||
| 119 | #define STT_LOPROC 13 | ||
| 120 | #define STT_HIPROC 15 | ||
| 121 | |||
| 122 | // Undefined name | ||
| 123 | #define STN_UNDEF 0 | ||
| 124 | |||
| 125 | // Relocation types | ||
| 126 | #define R_386_NONE 0 | ||
| 127 | #define R_386_32 1 | ||
| 128 | #define R_386_PC32 2 | ||
| 129 | #define R_386_GOT32 3 | ||
| 130 | #define R_386_PLT32 4 | ||
| 131 | #define R_386_COPY 5 | ||
| 132 | #define R_386_GLOB_DAT 6 | ||
| 133 | #define R_386_JMP_SLOT 7 | ||
| 134 | #define R_386_RELATIVE 8 | ||
| 135 | #define R_386_GOTOFF 9 | ||
| 136 | #define R_386_GOTPC 10 | ||
| 137 | |||
| 138 | // Segment types | 84 | // Segment types |
| 139 | #define PT_NULL 0 | 85 | #define PT_NULL 0 |
| 140 | #define PT_LOAD 1 | 86 | #define PT_LOAD 1 |
| @@ -146,39 +92,6 @@ enum ElfSectionFlags | |||
| 146 | #define PT_LOPROC 0x70000000 | 92 | #define PT_LOPROC 0x70000000 |
| 147 | #define PT_HIPROC 0x7FFFFFFF | 93 | #define PT_HIPROC 0x7FFFFFFF |
| 148 | 94 | ||
| 149 | // Segment flags | ||
| 150 | #define PF_X 1 | ||
| 151 | #define PF_W 2 | ||
| 152 | #define PF_R 4 | ||
| 153 | |||
| 154 | // Dynamic Array Tags | ||
| 155 | #define DT_NULL 0 | ||
| 156 | #define DT_NEEDED 1 | ||
| 157 | #define DT_PLTRELSZ 2 | ||
| 158 | #define DT_PLTGOT 3 | ||
| 159 | #define DT_HASH 4 | ||
| 160 | #define DT_STRTAB 5 | ||
| 161 | #define DT_SYMTAB 6 | ||
| 162 | #define DT_RELA 7 | ||
| 163 | #define DT_RELASZ 8 | ||
| 164 | #define DT_RELAENT 9 | ||
| 165 | #define DT_STRSZ 10 | ||
| 166 | #define DT_SYMENT 11 | ||
| 167 | #define DT_INIT 12 | ||
| 168 | #define DT_FINI 13 | ||
| 169 | #define DT_SONAME 14 | ||
| 170 | #define DT_RPATH 15 | ||
| 171 | #define DT_SYMBOLIC 16 | ||
| 172 | #define DT_REL 17 | ||
| 173 | #define DT_RELSZ 18 | ||
| 174 | #define DT_RELENT 19 | ||
| 175 | #define DT_PLTREL 20 | ||
| 176 | #define DT_DEBUG 21 | ||
| 177 | #define DT_TEXTREL 22 | ||
| 178 | #define DT_JMPREL 23 | ||
| 179 | #define DT_LOPROC 0x70000000 | ||
| 180 | #define DT_HIPROC 0x7FFFFFFF | ||
| 181 | |||
| 182 | typedef unsigned int Elf32_Addr; | 95 | typedef unsigned int Elf32_Addr; |
| 183 | typedef unsigned short Elf32_Half; | 96 | typedef unsigned short Elf32_Half; |
| 184 | typedef unsigned int Elf32_Off; | 97 | typedef unsigned int Elf32_Off; |
| @@ -239,41 +152,12 @@ struct Elf32_Sym { | |||
| 239 | Elf32_Half st_shndx; | 152 | Elf32_Half st_shndx; |
| 240 | }; | 153 | }; |
| 241 | 154 | ||
| 242 | #define ELF32_ST_BIND(i) ((i)>>4) | ||
| 243 | #define ELF32_ST_TYPE(i) ((i)&0xf) | ||
| 244 | #define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf)) | ||
| 245 | |||
| 246 | // Relocation entries | 155 | // Relocation entries |
| 247 | struct Elf32_Rel { | 156 | struct Elf32_Rel { |
| 248 | Elf32_Addr r_offset; | 157 | Elf32_Addr r_offset; |
| 249 | Elf32_Word r_info; | 158 | Elf32_Word r_info; |
| 250 | }; | 159 | }; |
| 251 | 160 | ||
| 252 | struct Elf32_Rela { | ||
| 253 | Elf32_Addr r_offset; | ||
| 254 | Elf32_Word r_info; | ||
| 255 | Elf32_Sword r_addend; | ||
| 256 | }; | ||
| 257 | |||
| 258 | #define ELF32_R_SYM(i) ((i)>>8) | ||
| 259 | #define ELF32_R_TYPE(i) ((unsigned char)(i)) | ||
| 260 | #define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t)) | ||
| 261 | |||
| 262 | struct Elf32_Dyn { | ||
| 263 | Elf32_Sword d_tag; | ||
| 264 | union { | ||
| 265 | Elf32_Word d_val; | ||
| 266 | Elf32_Addr d_ptr; | ||
| 267 | } d_un; | ||
| 268 | }; | ||
| 269 | |||
| 270 | enum KnownElfTypes { | ||
| 271 | KNOWNELF_PSP = 0, | ||
| 272 | KNOWNELF_DS = 1, | ||
| 273 | KNOWNELF_GBA = 2, | ||
| 274 | KNOWNELF_GC = 3, | ||
| 275 | }; | ||
| 276 | |||
| 277 | typedef int SectionID; | 161 | typedef int SectionID; |
| 278 | 162 | ||
| 279 | class ElfReader { | 163 | class ElfReader { |