On 19.08.2024 22:04, Martin Storsjö wrote:
On Mon, 19 Aug 2024, Pali Rohár wrote:

What about attribute naked? For I386 it is supported since gcc 8.

I think it may be ok. I have very little experience with this attribute myself though.

It seems like Wine are using this attribute, in some setups. And either they use a non-static function declared entirely in assembly, or static functions with the naked attribute.


I think that in this case using naked attribute should be fine, mostly because i386 assembly doesn't have to emit SEH. Unfortunately, on x86_64, it's broken in GCC as it emits .seh_endprologue directive, and thus does not give a chance for the function body to do it itself. Clang gets it right.


I generally think that naked attribute is a nicer way of writing assembly functions and proper handling of static functions is one of nice things about it. Unfortunately, we can't use it widely in Wine both because of GCC .seh_endprologue bug and because we still allow older compilers to be used. We use it for ARM64EC, where GCC compatibility is not a concern and where it has additional advantage of transparently taking care of generating entry thunks. That's also a reason why it may be nice to use it for ARM64EC support in mingw-w64-crt.


Jacek



_______________________________________________
Mingw-w64-public mailing list
Mingw-w64-public@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to