Disable alias attribute on macOS clang. (#19)

This commit is contained in:
squidbus 2025-03-04 07:57:36 -08:00 committed by GitHub
parent 3ee19542c9
commit dc4460eefd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 14 additions and 0 deletions

View File

@ -19,6 +19,11 @@ target_link_libraries(XenonRecomp PRIVATE
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
target_compile_options(XenonRecomp PRIVATE -Wno-switch -Wno-unused-variable -Wno-null-arithmetic)
# alias attribute not supported on Apple.
if (NOT APPLE)
target_compile_definitions(XenonRecomp PRIVATE XENON_RECOMP_USE_ALIAS)
endif()
endif()
target_compile_definitions(XenonRecomp PRIVATE _CRT_SECURE_NO_WARNINGS)

View File

@ -2358,7 +2358,10 @@ bool Recompiler::Recompile(const Function& fn)
name = fmt::format("sub_{}", fn.base);
}
#ifdef XENON_RECOMP_USE_ALIAS
println("__attribute__((alias(\"__imp__{}\"))) PPC_WEAK_FUNC({});", name, name);
#endif
println("PPC_FUNC_IMPL(__imp__{}) {{", name);
println("\tPPC_FUNC_PROLOGUE();");
@ -2419,6 +2422,12 @@ bool Recompiler::Recompile(const Function& fn)
println("}}\n");
#ifndef XENON_RECOMP_USE_ALIAS
println("PPC_WEAK_FUNC({}) {{", name);
println("\t__imp__{}(ctx, base);", name);
println("}}\n");
#endif
std::swap(out, tempString);
if (localVariables.ctr)
println("\tPPCRegister ctr{{}};");