Rob Shearman : winebuild: Refer to strings used in generated stubs by symbol rather than by offset to avoid problems when the compiler aligns the strings by 2 or more bytes .

Alexandre Julliard julliard at wine.codeweavers.com
Wed Apr 25 07:06:35 CDT 2007


Module: wine
Branch: master
Commit: 5fcc5d3f62396622020d3f29ee9ba4492dd04687
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=5fcc5d3f62396622020d3f29ee9ba4492dd04687

Author: Rob Shearman <rob at codeweavers.com>
Date:   Wed Apr 25 08:51:44 2007 +0100

winebuild: Refer to strings used in generated stubs by symbol rather than by offset to avoid problems when the compiler aligns the strings by 2 or more bytes.

---

 tools/winebuild/import.c |   19 +++++++++++--------
 1 files changed, 11 insertions(+), 8 deletions(-)

diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index 44c7802..da4b1db 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -1177,14 +1177,14 @@ static void output_external_link_imports( DLLSPEC *spec )
 void output_stubs( DLLSPEC *spec )
 {
     const char *name, *exp_name;
-    int i, pos;
+    int i, count;
 
     if (!has_stubs( spec )) return;
 
     output( "\n/* stub functions */\n\n" );
     output( "\t.text\n" );
 
-    for (i = pos = 0; i < spec->nb_entry_points; i++)
+    for (i = count = 0; i < spec->nb_entry_points; i++)
     {
         ORDDEF *odp = &spec->entry_points[i];
         if (odp->type != TYPE_STUB) continue;
@@ -1202,9 +1202,9 @@ void output_stubs( DLLSPEC *spec )
             output( "1:" );
             if (exp_name)
             {
-                output( "\tleal .L__wine_stub_strings+%d-1b(%%eax),%%ecx\n", pos );
+                output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name );
                 output( "\tpushl %%ecx\n" );
-                pos += strlen(exp_name) + 1;
+                count++;
             }
             else
                 output( "\tpushl $%d\n", odp->ordinal );
@@ -1215,8 +1215,8 @@ void output_stubs( DLLSPEC *spec )
         {
             if (exp_name)
             {
-                output( "\tpushl $.L__wine_stub_strings+%d\n", pos );
-                pos += strlen(exp_name) + 1;
+                output( "\tpushl $.L%s_string\n", name );
+                count++;
             }
             else
                 output( "\tpushl $%d\n", odp->ordinal );
@@ -1226,17 +1226,20 @@ void output_stubs( DLLSPEC *spec )
         output_function_size( name );
     }
 
-    if (pos)
+    if (count)
     {
         output( "\t%s\n", get_asm_string_section() );
-        output( ".L__wine_stub_strings:\n" );
         for (i = 0; i < spec->nb_entry_points; i++)
         {
             ORDDEF *odp = &spec->entry_points[i];
             if (odp->type != TYPE_STUB) continue;
             exp_name = odp->name ? odp->name : odp->export_name;
             if (exp_name)
+            {
+                name = get_stub_name( odp, spec );
+                output( ".L%s_string:\n", name );
                 output( "\t%s \"%s\"\n", get_asm_string_keyword(), exp_name );
+            }
         }
     }
 }




More information about the wine-cvs mailing list