在 2026-2-16 02:56, Pali Rohár 写道:
What is the difference between do_mingw_SEH_error_handler and 
__mingw_SEH_error_handler?
Should not be both functions of same type and with same ABI? I quite do
not understand why the local static function will work but the extern
function would not.

Or is the reason that the extern function should be mangled with
leading # character (as Jacek wrote in the above message) and static
local function do not have to?

Sorry if this is a stupid question, but I somehow have not caught this
topic and now I'm not sure about the formal syntax of GNU assembler
.seh_handler directive.


Good question. I don't know, sorry.

I remember that, a while ago, Jacek said that unmangled names (without #) are not included in archive headers, and I suspect that's what breaks ARM64EC actually. It's said that when doing a direct call with BL, the mangled name should be used.

However, the previous log says

   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)
   make[3]: *** [Makefile:2929: tstmainc.exe] Error 1

where there's `(EC symbol)` so I think that it's really `#__mingw_SEH_error_handler` in assembly. The function is just somehow missing. `%c` in assembly seems always producing the mangled name: https://godbolt.org/z/PqzKffMTK

The difference between static and extern functions is that, as long as pointers do not escape the current compilation unit, static functions are known to be called only by ARM64 and not x86-64; and if external calls to x86-64 functions are made in C, the compiler can handle them correctly.


--
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