[PATCH] ntdll: Use an explicit memcpy instead of a struct assignment

Martin Storsjo martin at martin.st
Fri Aug 14 06:22:45 CDT 2020


Clang generates a memcpy call for this struct memcpy in any case
(regardless of -fno-builtin), but the generated memcpy call uses
unix calling convention instead of the windows one (despite -mabi=ms,
which has no effect on x86 on clang) - while the ntdll internal
memcpy implementation, which ends up called, uses windows calling
conventions.

By using an explicit memcpy call, we make sure to end up using the
right, windows calling convention for the memcpy call.

This fixes wine built for x86_64 with current Xcode 11.6.

Signed-off-by: Martin Storsjo <martin at martin.st>
---
I've got an upcoming patch for clang, to make it respect -fno-builtin
with regards of generating calls to memcpy, but if accepted, that won't
be available in release versions of Xcode until earliest next year some
time.
---
 dlls/ntdll/locale.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/dlls/ntdll/locale.c b/dlls/ntdll/locale.c
index 81263f4616..91d91fa6a5 100644
--- a/dlls/ntdll/locale.c
+++ b/dlls/ntdll/locale.c
@@ -1009,7 +1009,7 @@ void WINAPI RtlResetRtlTranslations( const NLSTABLEINFO *info )
     NlsAnsiCodePage     = info->AnsiTableInfo.CodePage;
     NlsMbCodePageTag    = info->AnsiTableInfo.DBCSCodePage;
     NlsMbOemCodePageTag = info->OemTableInfo.DBCSCodePage;
-    nls_info = *info;
+    memcpy( &nls_info, info, sizeof(*info) );
 }
 
 
-- 
2.24.3 (Apple Git-128)




More information about the wine-devel mailing list