mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-02 07:46:01 +00:00
eadc477187
* Update makefiles * git subrepo clone git@github.com:EllipticEllipsis/fado.git tools/fado subrepo: subdir: "tools/fado" merged: "46c4d751a" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "46c4d751a" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "88114ebce" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "88114ebce" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * A few ideas for computing dependencies * Remove reserved identifiers from spec.h and util.h and add required headers * Fix a couple more headers * Program for reloc prerequisites * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "36a905f72" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "36a905f72" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Update makefile to make dependency files and use overlay's name * git subrepo pull tools/fado subrepo: subdir: "tools/fado" merged: "43c339a59" upstream: origin: "git@github.com:EllipticEllipsis/fado.git" branch: "master" commit: "43c339a59" git-subrepo: version: "0.4.3" origin: "https://github.com/ingydotnet/git-subrepo.git" commit: "2f68596" * Change awk to grep, delete ZAPD files, gitignore elf * Delete all the cfg files * Fix memory leaks * Rename and add coloured errors * Makefile tweaks - preprocess spec before grep - split order prerequisites via phony target to reduce dependency edges - remove `resources` target - remove separate overlays targets - use `$(SPEC)` throughout - change to using filenames of relocs for overlay names via `$*` - Rearrange targets to better reflect their categories * Update gitignore * Review * Add a check for the reloc file name * get_segment_by_name * get_stmt_id_by_stmt_name * Cleaning up * algorithm change * function rename * Fix typos Co-authored-by: angie <angheloalf95@gmail.com>
70 lines
2.3 KiB
C
70 lines
2.3 KiB
C
/* Copyright (C) 2021 Elliptic Ellipsis */
|
|
/* SPDX-License-Identifier: AGPL-3.0-only */
|
|
#pragma once
|
|
|
|
#include <stddef.h>
|
|
#include <stdio.h>
|
|
#include <elf.h>
|
|
|
|
#include "vc_vector/vc_vector.h"
|
|
|
|
#define FAIRY_DEF_STRING(prefix, x) \
|
|
{ prefix##x, #x }
|
|
|
|
typedef enum {
|
|
VERBOSITY_NONE,
|
|
VERBOSITY_INFO,
|
|
VERBOSITY_DEBUG //,
|
|
} VerbosityLevel;
|
|
|
|
extern VerbosityLevel gVerbosity;
|
|
|
|
typedef Elf32_Ehdr FairyFileHeader;
|
|
typedef Elf32_Shdr FairySecHeader;
|
|
typedef Elf32_Sym FairySym;
|
|
typedef Elf32_Rel FairyRel;
|
|
|
|
typedef struct {
|
|
int define;
|
|
const char* string;
|
|
} FairyDefineString;
|
|
|
|
typedef struct {
|
|
void* sectionData;
|
|
size_t sectionSize;
|
|
} FairySectionInfo;
|
|
|
|
typedef struct {
|
|
FairySectionInfo symtabInfo;
|
|
char* strtab;
|
|
Elf32_Word progBitsSizes[3];
|
|
vc_vector* progBitsSections;
|
|
FairySectionInfo relocTablesInfo[3];
|
|
} FairyFileInfo;
|
|
|
|
typedef enum {
|
|
FAIRY_SECTION_TEXT,
|
|
FAIRY_SECTION_DATA,
|
|
FAIRY_SECTION_RODATA,
|
|
FAIRY_SECTION_OTHER //,
|
|
} FairySection;
|
|
|
|
/* Prints debugging information to stderr. To be used via the macros. */
|
|
int Fairy_DebugPrintf(const char* file, int line, const char* func, VerbosityLevel level, const char* fmt, ...);
|
|
#define FAIRY_INFO_PRINTF(fmt, ...) Fairy_DebugPrintf(__FILE__, __LINE__, __func__, VERBOSITY_INFO, fmt, __VA_ARGS__)
|
|
#define FAIRY_DEBUG_PRINTF(fmt, ...) Fairy_DebugPrintf(__FILE__, __LINE__, __func__, VERBOSITY_DEBUG, fmt, __VA_ARGS__)
|
|
|
|
const char* Fairy_StringFromDefine(const FairyDefineString* dict, int define);
|
|
bool Fairy_StartsWith(const char* string, const char* initial);
|
|
|
|
FairyFileHeader* Fairy_ReadFileHeader(FairyFileHeader* header, FILE* file);
|
|
FairySecHeader* Fairy_ReadSectionTable(FairySecHeader* sectionTable, FILE* file, size_t tableOffset, size_t number);
|
|
FairySym* Fairy_ReadSymbolTable(FairySym* symbolTable, FILE* file, size_t tableOffset, size_t tableSize);
|
|
char* Fairy_ReadStringTable(char* stringTable, FILE* file, size_t tableOffset, size_t tableSize);
|
|
FairyRel* Fairy_ReadRelocs(FairyRel* relocTable, FILE* file, size_t offset, size_t number);
|
|
|
|
char* Fairy_GetSectionName(FairySecHeader* sectionTable, char* shstrtab, size_t index);
|
|
char* Fairy_GetSymbolName(FairySym* symtab, char* strtab, size_t index);
|
|
|
|
void Fairy_InitFile(FairyFileInfo* fileInfo, FILE* file);
|
|
void Fairy_DestroyFile(FairyFileInfo* fileInfo);
|