On Sat, 22 Mar 2025, Jacek Caban wrote:
mingw-w64-crt implements a number of functions that the compiler considers
built-in. Currently, we must be cautious about compiler optimizations, as they
may not align with our intentions. In theory, the compiler could optimize an
implementation of such a function back into a call to itself.
Rather than second-guessing the optimizer and reimplementing problematic
functions in assembly, disable built-in functions globally for mingw-w64-crt.
---
mingw-w64-crt/Makefile.am | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/mingw-w64-crt/Makefile.am b/mingw-w64-crt/Makefile.am
index 779beab17..f49f316c6 100644
--- a/mingw-w64-crt/Makefile.am
+++ b/mingw-w64-crt/Makefile.am
@@ -20,7 +20,7 @@ else
endif
Patches 2-5 in this series, replacing memset with various struct
assignments, feel quite cryptic on their own - I think they would be more
understandable if their commit messages would explan, that it is
preparation for using -fno-builtin, which makes the compiler not expand
memset() inline.
I feel it may be hard to keep track of this going forward though; it's
easy to add another memset which doesn't get compiled the way we expect it
to. But I'm not sure if there's any other good way either...
It would be nice if we could do e.g. "-fno-builtin -fbuiltin-memset", to
enable treating memset as builtin, but not the others - but there's no
"-fbuiltin-memset". And enumerating all possible -fno-builtin-<foo> feels
messy and hard to keep track of.
So I guess this is as good as it gets...
Patches 1, 6 and 7 seem fine to me.
// Martin
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public