Files
SpotiFLAC-Mobile/linux/runner/system_unwinder.h
T
zarzet a3e88bbf01 fix(linux): use the system unwinder for every library in the process
The Flutter engine exports ten entry points of an unwinder of its own.
Libraries loaded after it bound those to the engine and the rest, such as
_Unwind_GetCFA, to libgcc_s, and the two do not share a context. The first
Lua error in the system libmpv's LuaJIT ended the app with a segmentation
fault (at start, on a song change, on repeat), and a C++ exception in a
system library ended it with an abort.

The runner now lists libgcc_s ahead of the engine, so later libraries find
it first. As a check behind that, main() looks up which library answers
for _Unwind_RaiseException and, if it is still the engine, starts the app
once more with libgcc_s preloaded, then gives programs it starts the
environment it was given.

Not compiled or run on Linux yet.

Refs mornyeapp/Mornye-Desktop#37, mornyeapp/Mornye-Desktop#40
2026-11-19 01:36:23 +07:00

20 lines
948 B
C

#ifndef RUNNER_SYSTEM_UNWINDER_H_
#define RUNNER_SYSTEM_UNWINDER_H_
// Makes libgcc_s the C++ unwinder of every library in the process, then
// returns. Call it first in main(), before any thread starts.
//
// The Flutter engine exports part of an unwinder of its own
// (_Unwind_RaiseException and nine more). A library loaded after it binds
// those calls to the engine and the rest (_Unwind_GetCFA and others the
// engine does not export) to libgcc_s, and the two do not share a context:
// the first Lua error in libmpv's LuaJIT, or the first C++ exception in any
// system library, ends the app with a segmentation fault or an abort.
//
// The runner lists libgcc_s ahead of the engine (see CMakeLists.txt), which
// already settles it. This is the check behind that: if the engine's copy
// still comes first, the app starts itself again with libgcc_s preloaded.
void use_system_unwinder(char** argv);
#endif // RUNNER_SYSTEM_UNWINDER_H_