在 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).

Indeed there are linker errors like

   ld.lld: error: undefined symbol: __mingw_SEH_error_handler (EC symbol)
   >>> referenced by 
C:/a/_temp/msys64/llvm-mingw/arm64ec-w64-mingw32/lib/crt2.o:(.xdata)
   clang-21: error: linker command failed with exit code 1 (use -v to see 
invocation)

which is referenced from a CRT object file, and should have existed in 
libmingw32.a.


However, the old code also uses the unmangled form of `__C_specific_handler` which is imported from libkernel32.a or libmsvcrt.a, but it doesn't fail:

   .seh_handler __C_specific_handler, @except






--
Best regards,
LIU Hao

Attachment: OpenPGP_signature.asc
Description: OpenPGP digital signature

_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to