[PATCH] winebuild: When building implibs, invoke dlltool with a machine type. (try 2)

Charles Davis cdavis5x at gmail.com
Wed Feb 10 03:58:50 CST 2016


That way, if the installed MinGW toolchain is multilib enabled (as mine
is), the import libraries will get built for the correct architecture.

Try 2: Correct machine name for x86-64.

Signed-off-by: Charles Davis <cdavis5x at gmail.com>
---
 tools/winebuild/import.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 13596a4..ef02ab1 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1329,6 +1329,7 @@ void output_import_lib( DLLSPEC *spec, char **argv )
 {
     struct strarray *args;
     char *def_file;
+    const char *as_flags, *m_flag;
 
     if (target_platform != PLATFORM_WINDOWS)
         fatal_error( "Unix-style import libraries not supported yet\n" );
@@ -1342,7 +1343,23 @@ void output_import_lib( DLLSPEC *spec, char **argv )
     output_file = NULL;
 
     args = find_tool( "dlltool", NULL );
+    switch (target_cpu)
+    {
+        case CPU_x86:
+            m_flag = "i386";
+            as_flags = "--as-flags=--32";
+            break;
+        case CPU_x86_64:
+            m_flag = "x86-64";
+            as_flags = "--as-flags=--64";
+            break;
+        default:
+            m_flag = NULL;
+            break;
+    }
     strarray_add( args, "-k", "-l", output_file_name, "-d", def_file, NULL );
+    if (m_flag)
+        strarray_add( args, "-m", m_flag, as_flags, NULL );
     spawn( args );
     strarray_free( args );
 
-- 
2.7.1




More information about the wine-patches mailing list