pspsdk-1.0+beta2
|
#include <stdio.h>
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
#include <assert.h>
#include <ctype.h>
#include "types.h"
#include "elftypes.h"
#include "prxtypes.h"
Functions | |
int | process_args (int argc, char **argv) |
void | print_help (void) |
unsigned char * | load_file (const char *file) |
int | validate_header (unsigned char *data) |
int | load_sections (unsigned char *data) |
int | remove_weak_relocs (struct ElfSection *pReloc, struct ElfSection *pSymbol, struct ElfSection *pString) |
int | process_relocs (void) |
void | reindex_sections (void) |
int | load_elf (const char *elf) |
int | calculate_outsize (void) |
void | output_header (unsigned char *data) |
void | output_ph (unsigned char *data) |
void | output_alloc (unsigned char *data) |
void | output_sh (unsigned char *data) |
void | output_relocs (unsigned char *data) |
void | output_shstrtab (unsigned char *data) |
int | output_prx (const char *prxfile) |
void | free_data (void) |
int | main (int argc, char **argv) |
int calculate_outsize | ( | void | ) |
References ElfSection::blOutput, ELF_SH_STRTAB, fprintf(), i, ElfSection::iAddr, ElfSection::iFlags, ElfSection::iInfo, ElfHeader::iShnum, ElfSection::iSize, ElfSection::iType, SHF_ALLOC, SHT_PROGBITS, SHT_PRXRELOC, SHT_REL, stderr, strlen(), and ElfSection::szName.
Referenced by output_prx().
int load_elf | ( | const char * | elf | ) |
References load_file(), load_sections(), NULL, process_relocs(), reindex_sections(), and validate_header().
unsigned char* load_file | ( | const char * | file | ) |
int load_sections | ( | unsigned char * | data | ) |
References ElfSection::blOutput, fprintf(), i, ElfSection::iAddr, ElfSection::iAddralign, ElfSection::iEntsize, ElfSection::iFlags, ElfSection::iIndex, ElfSection::iInfo, ElfSection::iLink, ElfSection::iName, ElfSection::iOffset, ElfHeader::iShentsize, ElfHeader::iShnum, ElfHeader::iShoff, ElfHeader::iShstrndx, ElfSection::iSize, iSize, ElfSection::iType, LW, malloc(), memset(), NULL, ElfSection::pData, ElfSection::pRef, PSP_MODULE_INFO_NAME, PSP_MODULE_REMOVE_REL, SHF_ALLOC, SHT_PRXRELOC, SHT_REL, stderr, strcmp(), strcpy(), and ElfSection::szName.
int main | ( | int | argc, |
char ** | argv | ||
) |
References free_data(), load_elf(), output_prx(), print_help(), and process_args().
void output_alloc | ( | unsigned char * | data | ) |
References i, ElfHeader::iShnum, iSize, memcpy(), and SHT_PROGBITS.
Referenced by output_prx().
void output_header | ( | unsigned char * | data | ) |
References ELF_PRX_TYPE, ElfHeader::iClass, ElfHeader::iData, ElfHeader::iEntry, ElfHeader::iFlags, ElfHeader::iIdver, ElfHeader::iMachine, ElfHeader::iMagic, ElfHeader::iVersion, SH, and SW.
Referenced by output_prx().
void output_ph | ( | unsigned char * | data | ) |
References PspModuleInfo::flags, ElfSection::iAddr, LW, Elf32_Phdr::p_align, Elf32_Phdr::p_filesz, Elf32_Phdr::p_flags, Elf32_Phdr::p_memsz, Elf32_Phdr::p_offset, Elf32_Phdr::p_paddr, Elf32_Phdr::p_type, Elf32_Phdr::p_vaddr, ElfSection::pData, and SW.
Referenced by output_prx().
int output_prx | ( | const char * | prxfile | ) |
References calculate_outsize(), fclose(), fopen(), fp, fprintf(), free(), fwrite(), malloc(), memset(), NULL, output_alloc(), output_header(), output_ph(), output_relocs(), output_sh(), output_shstrtab(), size, and stderr.
Referenced by main().
void output_relocs | ( | unsigned char * | data | ) |
References count, i, ElfHeader::iShnum, ElfSection::iSize, iSize, LW, memcpy(), Elf32_Rel::r_info, SHT_PRXRELOC, SHT_REL, and SW.
Referenced by output_prx().
void output_sh | ( | unsigned char * | data | ) |
References i, ElfSection::iAddr, ElfSection::iAddralign, ElfSection::iEntsize, ElfSection::iFlags, ElfSection::iIndex, ElfHeader::iShnum, ElfSection::iSize, ElfSection::iType, memset(), ElfSection::pRef, SHT_PROGBITS, SHT_PRXRELOC, SHT_REL, SHT_STRTAB, strlen(), and SW.
Referenced by output_prx().
void output_shstrtab | ( | unsigned char * | data | ) |
References ELF_SH_STRTAB, fprintf(), i, ElfHeader::iShnum, memset(), stderr, strcpy(), and strlen().
Referenced by output_prx().
int process_args | ( | int | argc, |
char ** | argv | ||
) |
int process_relocs | ( | void | ) |
References ElfSection::blOutput, fprintf(), i, ElfSection::iLink, ElfHeader::iShnum, ElfSection::iType, NULL, remove_weak_relocs(), SHT_REL, SHT_STRTAB, SHT_SYMTAB, and stderr.
Referenced by load_elf().
void reindex_sections | ( | void | ) |
References ElfSection::blOutput, i, ElfSection::iIndex, and ElfHeader::iShnum.
Referenced by load_elf().
int remove_weak_relocs | ( | struct ElfSection * | pReloc, |
struct ElfSection * | pSymbol, | ||
struct ElfSection * | pString | ||
) |
References ElfSection::blOutput, ELF32_R_SYM, fprintf(), free(), i, ElfSection::iSize, iSize, LH, LW, malloc(), memcpy(), NULL, ElfSection::pData, Elf32_Rel::r_info, stderr, and ElfSection::szName.
Referenced by process_relocs().
int validate_header | ( | unsigned char * | data | ) |
References ELF_EXEC_TYPE, ELF_MACHINE_MIPS, ELF_MAGIC, ELF_PRX_TYPE, fprintf(), ElfHeader::iClass, ElfHeader::iData, ElfHeader::iEhsize, ElfHeader::iEntry, ElfHeader::iFlags, ElfHeader::iIdver, ElfHeader::iMachine, ElfHeader::iMagic, ElfHeader::iPhentsize, ElfHeader::iPhnum, ElfHeader::iPhoff, ElfHeader::iShentsize, ElfHeader::iShnum, ElfHeader::iShoff, ElfHeader::iShstrndx, ElfHeader::iType, ElfHeader::iVersion, LH, LW, and stderr.