This commit is contained in:
Anghelo Carvajal 2024-05-14 12:14:37 -04:00 committed by GitHub
commit 19e9e0fd6f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 56 additions and 0 deletions

View file

@ -505,6 +505,9 @@ std::unordered_set<std::string> ignored_funcs {
"__divdi3", "__divdi3",
"__udivdi3", "__udivdi3",
"__umoddi3", "__umoddi3",
"div64_64",
"div64_32",
"__moddi3",
// ido math routines // ido math routines
"__ll_div", "__ll_div",
"__ll_lshift", "__ll_lshift",
@ -534,15 +537,25 @@ std::unordered_set<std::string> ignored_funcs {
}; };
std::unordered_set<std::string> renamed_funcs{ std::unordered_set<std::string> renamed_funcs{
// Math
"sincosf", "sincosf",
"sinf", "sinf",
"cosf", "cosf",
"__sinf", "__sinf",
"__cosf", "__cosf",
"asinf",
"acosf",
"atanf",
"atan2f",
"tanf",
"sqrt", "sqrt",
"sqrtf", "sqrtf",
// Memory
"memcpy", "memcpy",
"memset", "memset",
"memmove",
"memcmp",
"strcmp", "strcmp",
"strcat", "strcat",
"strcpy", "strcpy",
@ -553,8 +566,12 @@ std::unordered_set<std::string> renamed_funcs{
"bzero", "bzero",
"bcopy", "bcopy",
"bcmp", "bcmp",
// long jumps
"setjmp", "setjmp",
"longjmp", "longjmp",
// Math 2
"ldiv", "ldiv",
"lldiv", "lldiv",
"ceil", "ceil",
@ -562,6 +579,8 @@ std::unordered_set<std::string> renamed_funcs{
"floor", "floor",
"floorf", "floorf",
"fmodf", "fmodf",
"fmod",
"modf",
"lround", "lround",
"lroundf", "lroundf",
"nearbyint", "nearbyint",
@ -570,11 +589,43 @@ std::unordered_set<std::string> renamed_funcs{
"roundf", "roundf",
"trunc", "trunc",
"truncf", "truncf",
// printf family
"vsprintf", "vsprintf",
"gcvt",
"fcvt",
"ecvt",
"__assert", "__assert",
// allocations
"malloc", "malloc",
"free", "free",
"realloc", "realloc",
"calloc",
// rand
"rand",
"srand",
"random",
// gzip
"huft_build",
"huft_free",
"inflate_codes",
"inflate_stored",
"inflate_fixed",
"inflate_dynamic",
"inflate_block",
"inflate",
"expand_gzip",
"auRomDataRead"
"data_write",
"unzip",
"updcrc",
"clear_bufs",
"fill_inbuf",
"flush_window",
}; };
bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, ELFIO::section* symtab_section, uint32_t entrypoint, bool has_entrypoint, bool use_absolute_symbols) { bool read_symbols(RecompPort::Context& context, const ELFIO::elfio& elf_file, ELFIO::section* symtab_section, uint32_t entrypoint, bool has_entrypoint, bool use_absolute_symbols) {
@ -1249,6 +1300,8 @@ int main(int argc, char** argv) {
std::ofstream func_header_file{ config.output_func_path / "funcs.h" }; std::ofstream func_header_file{ config.output_func_path / "funcs.h" };
fmt::print(func_header_file, fmt::print(func_header_file,
"#ifndef __RECOMPED_FUNCS_H__\n"
"#define __RECOMPED_FUNCS_H__\n"
"#include \"recomp.h\"\n" "#include \"recomp.h\"\n"
"\n" "\n"
"#ifdef __cplusplus\n" "#ifdef __cplusplus\n"
@ -1453,6 +1506,8 @@ int main(int argc, char** argv) {
"#ifdef __cplusplus\n" "#ifdef __cplusplus\n"
"}}\n" "}}\n"
"#endif\n" "#endif\n"
"\n"
"#endif\n"
); );
{ {

View file

@ -1067,6 +1067,7 @@ bool RecompPort::recompile_function(const RecompPort::Context& context, const Re
// Write the file header // Write the file header
fmt::print(output_file, fmt::print(output_file,
"#include \"recomp.h\"\n" "#include \"recomp.h\"\n"
"#include \"funcs.h\"\n"
"#include \"disable_warnings.h\"\n" "#include \"disable_warnings.h\"\n"
"\n"); "\n");
} }