在 2026-2-4 07:38, Jacek Caban 写道:
On 12/26/25 14:05, Pali Rohár wrote:So the safest solution is, still, to hard-code the handler name in assembly string.That is truth. I wanted to avoid hardcoding symbol names to prevent possible symbol mangling issues, and the %p or %c modifier looked like something which is prepared for those cases like this one.FWIW, on ARM64EC the compiler cannot know whether you mean the mangled or demangled symbol; both are valid names referring to the same thing, but with different meanings. In this case, you want the mangled form ("#__mingw_SEH_error_handler"). The demangled form will often work, but it is less reliable (archive symbol tables do not include it, so it relies on the alias being defined one way or another).
One possible workaround for that is to define an ARM64EC thunk with internal linkage for the handler, and to use the thunk as the handler which will not have a mangled name:
static EXCEPTION_DISPOSITION
__cdecl
do_mingw_SEH_error_handler(EXCEPTION_RECORD* ExceptionRecord,
void* EstablisherFrame, CONTEXT* ContextRecord,
void* DispatcherContext)
{
return __mingw_SEH_error_handler(ExceptionRecord, EstablisherFrame,
ContextRecord, DispatcherContext);
}
// ...
__asm__ (".seh_handler %c0, " ASM_EXCEPT :: "i"
(do_mingw_SEH_error_handler));
--
Best regards,
LIU Hao
OpenPGP_signature.asc
Description: OpenPGP digital signature
_______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
