From 5fcc5d3f62396622020d3f29ee9ba4492dd04687 Mon Sep 17 00:00:00 2001 From: Rob Shearman Date: Wed, 25 Apr 2007 08:51:44 +0100 Subject: [PATCH] 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 file changed, 11 insertions(+), 8 deletions(-) diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 44c7802a3b7..da4b1db7643 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 ); + } } } } -- 2.11.4.GIT