Alexandre Julliard : winebuild: Set the import hint based on the name index.

Alexandre Julliard julliard at winehq.org
Wed Mar 20 17:09:12 CDT 2019


Module: wine
Branch: master
Commit: 074ec5844bdd351d83aebfd90a14a68972079f59
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=074ec5844bdd351d83aebfd90a14a68972079f59

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Mar 20 11:49:38 2019 +0100

winebuild: Set the import hint based on the name index.

Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/winebuild/build.h  |  1 +
 tools/winebuild/import.c | 13 ++++++++-----
 tools/winebuild/parser.c |  1 +
 3 files changed, 10 insertions(+), 5 deletions(-)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 603b6e2..e9ef52b 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -98,6 +98,7 @@ typedef struct
 {
     ORD_TYPE    type;
     int         ordinal;
+    int         hint;
     int         lineno;
     int         flags;
     char       *name;         /* public name of this function */
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 984bffd..8838769 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -43,6 +43,7 @@ struct import_func
     const char *name;
     const char *export_name;
     int         ordinal;
+    int         hint;
 };
 
 struct import
@@ -332,7 +333,8 @@ struct import *add_static_import_dll( const char *name )
 }
 
 /* add a function to the list of imports from a given dll */
-static void add_import_func( struct import *imp, const char *name, const char *export_name, int ordinal )
+static void add_import_func( struct import *imp, const char *name, const char *export_name,
+                             int ordinal, int hint )
 {
     if (imp->nb_imports == imp->max_imports)
     {
@@ -343,6 +345,7 @@ static void add_import_func( struct import *imp, const char *name, const char *e
     imp->imports[imp->nb_imports].name = name;
     imp->imports[imp->nb_imports].export_name = export_name;
     imp->imports[imp->nb_imports].ordinal = ordinal;
+    imp->imports[imp->nb_imports].hint = hint;
     imp->nb_imports++;
 }
 
@@ -361,9 +364,9 @@ static void add_undef_import( const char *name, int is_ordinal )
 
     import = add_static_import_dll( dll_name );
     if (is_ordinal)
-        add_import_func( import, NULL, xstrdup( p ), ordinal );
+        add_import_func( import, NULL, xstrdup( p ), ordinal, 0 );
     else
-        add_import_func( import, xstrdup( p ), NULL, ordinal );
+        add_import_func( import, xstrdup( p ), NULL, ordinal, 0 );
 }
 
 /* get the default entry point for a given spec file */
@@ -587,7 +590,7 @@ void resolve_dll_imports( DLLSPEC *spec, struct list *list )
                 else
                 {
                     add_import_func( imp, (odp->flags & FLAG_NONAME) ? NULL : odp->name,
-                                     odp->export_name, odp->ordinal );
+                                     odp->export_name, odp->ordinal, odp->hint );
                     remove_name( &undef_symbols, j-- );
                 }
             }
@@ -769,7 +772,7 @@ static void output_immediate_imports(void)
             if (!func->name) continue;
             output( "\t.align %d\n", get_alignment(2) );
             output( ".L__wine_spec_import_data_%s_%s:\n", import->c_name, func->name );
-            output( "\t.short %d\n", func->ordinal );
+            output( "\t.short %d\n", func->hint );
             output( "\t%s \"%s\"\n", get_asm_string_keyword(), func->name );
         }
     }
diff --git a/tools/winebuild/parser.c b/tools/winebuild/parser.c
index dfb7f6f..ea9e939 100644
--- a/tools/winebuild/parser.c
+++ b/tools/winebuild/parser.c
@@ -756,6 +756,7 @@ static void assign_names( DLLSPEC *spec )
 
         /* sort the list of names */
         qsort( spec->names, spec->nb_names, sizeof(spec->names[0]), name_compare );
+        for (i = 0; i < spec->nb_names; i++) spec->names[i]->hint = i;
     }
 }
 




More information about the wine-cvs mailing list