2
1
Fork 0
mirror of https://github.com/yuzu-emu/yuzu.git synced 2024-07-04 23:31:19 +01:00

Elf: Removed unused macros, changed #include of "common.h" to just "common_types.h".

This commit is contained in:
bunnei 2014-06-17 06:23:46 -04:00
parent 13bdaa6c60
commit c144ed5058

View file

@ -4,7 +4,7 @@
#pragma once #pragma once
#include "common/common.h" #include "common/common_types.h"
// ELF Header Constants // ELF Header Constants
@ -52,27 +52,8 @@ enum ElfMachine {
#define ELFMAG2 'L' #define ELFMAG2 'L'
#define ELFMAG3 'F' #define ELFMAG3 'F'
// File class
#define ELFCLASSNONE 0
#define ELFCLASS32 1
#define ELFCLASS64 2
// Encoding
#define ELFDATANONE 0
#define ELFDATA2LSB 1
#define ELFDATA2MSB 2
// Sections constants // Sections constants
// Section indexes
#define SHN_UNDEF 0
#define SHN_LORESERVE 0xFF00
#define SHN_LOPROC 0xFF00
#define SHN_HIPROC 0xFF1F
#define SHN_ABS 0xFFF1
#define SHN_COMMON 0xFFF2
#define SHN_HIRESERVE 0xFFFF
// Section types // Section types
#define SHT_NULL 0 #define SHT_NULL 0
#define SHT_PROGBITS 1 #define SHT_PROGBITS 1
@ -91,9 +72,6 @@ enum ElfMachine {
#define SHT_LOUSER 0x80000000 #define SHT_LOUSER 0x80000000
#define SHT_HIUSER 0xFFFFFFFF #define SHT_HIUSER 0xFFFFFFFF
// Custom section types
#define SHT_PSPREL 0x700000a0
// Section flags // Section flags
enum ElfSectionFlags enum ElfSectionFlags
{ {
@ -103,38 +81,6 @@ enum ElfSectionFlags
SHF_MASKPROC = 0xF0000000, SHF_MASKPROC = 0xF0000000,
}; };
// Symbol binding
#define STB_LOCAL 0
#define STB_GLOBAL 1
#define STB_WEAK 2
#define STB_LOPROC 13
#define STB_HIPROC 15
// Symbol types
#define STT_NOTYPE 0
#define STT_OBJECT 1
#define STT_FUNC 2
#define STT_SECTION 3
#define STT_FILE 4
#define STT_LOPROC 13
#define STT_HIPROC 15
// Undefined name
#define STN_UNDEF 0
// Relocation types
#define R_386_NONE 0
#define R_386_32 1
#define R_386_PC32 2
#define R_386_GOT32 3
#define R_386_PLT32 4
#define R_386_COPY 5
#define R_386_GLOB_DAT 6
#define R_386_JMP_SLOT 7
#define R_386_RELATIVE 8
#define R_386_GOTOFF 9
#define R_386_GOTPC 10
// Segment types // Segment types
#define PT_NULL 0 #define PT_NULL 0
#define PT_LOAD 1 #define PT_LOAD 1
@ -146,39 +92,6 @@ enum ElfSectionFlags
#define PT_LOPROC 0x70000000 #define PT_LOPROC 0x70000000
#define PT_HIPROC 0x7FFFFFFF #define PT_HIPROC 0x7FFFFFFF
// Segment flags
#define PF_X 1
#define PF_W 2
#define PF_R 4
// Dynamic Array Tags
#define DT_NULL 0
#define DT_NEEDED 1
#define DT_PLTRELSZ 2
#define DT_PLTGOT 3
#define DT_HASH 4
#define DT_STRTAB 5
#define DT_SYMTAB 6
#define DT_RELA 7
#define DT_RELASZ 8
#define DT_RELAENT 9
#define DT_STRSZ 10
#define DT_SYMENT 11
#define DT_INIT 12
#define DT_FINI 13
#define DT_SONAME 14
#define DT_RPATH 15
#define DT_SYMBOLIC 16
#define DT_REL 17
#define DT_RELSZ 18
#define DT_RELENT 19
#define DT_PLTREL 20
#define DT_DEBUG 21
#define DT_TEXTREL 22
#define DT_JMPREL 23
#define DT_LOPROC 0x70000000
#define DT_HIPROC 0x7FFFFFFF
typedef unsigned int Elf32_Addr; typedef unsigned int Elf32_Addr;
typedef unsigned short Elf32_Half; typedef unsigned short Elf32_Half;
typedef unsigned int Elf32_Off; typedef unsigned int Elf32_Off;
@ -239,41 +152,12 @@ struct Elf32_Sym {
Elf32_Half st_shndx; Elf32_Half st_shndx;
}; };
#define ELF32_ST_BIND(i) ((i)>>4)
#define ELF32_ST_TYPE(i) ((i)&0xf)
#define ELF32_ST_INFO(b,t) (((b)<<4)+((t)&0xf))
// Relocation entries // Relocation entries
struct Elf32_Rel { struct Elf32_Rel {
Elf32_Addr r_offset; Elf32_Addr r_offset;
Elf32_Word r_info; Elf32_Word r_info;
}; };
struct Elf32_Rela {
Elf32_Addr r_offset;
Elf32_Word r_info;
Elf32_Sword r_addend;
};
#define ELF32_R_SYM(i) ((i)>>8)
#define ELF32_R_TYPE(i) ((unsigned char)(i))
#define ELF32_R_INFO(s,t) (((s)<<8 )+(unsigned char)(t))
struct Elf32_Dyn {
Elf32_Sword d_tag;
union {
Elf32_Word d_val;
Elf32_Addr d_ptr;
} d_un;
};
enum KnownElfTypes {
KNOWNELF_PSP = 0,
KNOWNELF_DS = 1,
KNOWNELF_GBA = 2,
KNOWNELF_GC = 3,
};
typedef int SectionID; typedef int SectionID;
class ElfReader { class ElfReader {