fix(libc): hand out the unwind cursor table through a _nid_no_patch export
_Unwind_Context took its cursor table from LibcUnwind::CursorSlots, a C++ data symbol of libc. On Windows LibcUnwind::Frame holds an _Unwind_Context, so libSceAgcDriver, which builds frames for its worker sampler, imported _ZN10LibcUnwind11CursorSlotsE from libc.prx. The NID patcher renames that export in the patched libc and leaves the import alone, so the patched libSceAgcDriver, libSceAgc and libSceVideoOut failed to load with error 127 and patched_libraries failed. The table is now file-local and the context reads it through UnwindCursorSlots_nid_no_patch, which keeps its name on both sides.
This commit is contained in:
parent
6e83cad175
commit
3a9cc63683
|
|
@ -9,12 +9,10 @@
|
|||
#include "prx/libc/include/General.hpp"
|
||||
#include "prx/libc/include/specifics/itanium/UnwindAbi.hpp"
|
||||
|
||||
namespace LibcUnwind {
|
||||
extern const std::uintptr_t CursorSlots[];
|
||||
}
|
||||
extern "C" const std::uintptr_t* UnwindCursorSlots_nid_no_patch();
|
||||
|
||||
struct _Unwind_Context {
|
||||
const std::uintptr_t* cursor = LibcUnwind::CursorSlots;
|
||||
const std::uintptr_t* cursor = UnwindCursorSlots_nid_no_patch();
|
||||
std::uintptr_t registers[17] {};
|
||||
#ifdef _WIN32
|
||||
std::uintptr_t vectorRegisters[16][2] {};
|
||||
|
|
|
|||
|
|
@ -64,9 +64,7 @@ void APS5_VABI CursorUnsupported(_Unwind_Context*) {
|
|||
template<class Function> std::uintptr_t Slot(Function function) {
|
||||
return reinterpret_cast<std::uintptr_t>(function);
|
||||
}
|
||||
}
|
||||
|
||||
namespace LibcUnwind {
|
||||
const std::uintptr_t CursorSlots[] = {
|
||||
Slot(&CursorUnsupported),
|
||||
Slot(&CursorUnsupported),
|
||||
|
|
@ -86,6 +84,10 @@ const std::uintptr_t CursorSlots[] = {
|
|||
};
|
||||
}
|
||||
|
||||
const std::uintptr_t* UnwindCursorSlots_nid_no_patch() {
|
||||
return CursorSlots;
|
||||
}
|
||||
|
||||
#if defined(__linux__) || defined(_WIN32) || defined(__APPLE__)
|
||||
|
||||
extern "C" _Unwind_Reason_Code __gxx_personality_v0(int, _Unwind_Action, std::uint64_t, _Unwind_Exception*, _Unwind_Context*);
|
||||
|
|
|
|||
Loading…
Reference in New Issue