diff --git a/dlls/krnl386.exe16/ne_module.c b/dlls/krnl386.exe16/ne_module.c index 76ef3557068..357a0e98d4a 100644 --- a/dlls/krnl386.exe16/ne_module.c +++ b/dlls/krnl386.exe16/ne_module.c @@ -921,6 +921,7 @@ static HMODULE16 NE_DoLoadBuiltinModule( const IMAGE_DOS_HEADER *mz_header, cons } patch_code_segment( pModule ); + *(void **)mz_header->e_res2 = &wine_ldt_copy; return hInstance; } diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c index 87183460266..3b1f4cd18e0 100644 --- a/tools/winebuild/relay.c +++ b/tools/winebuild/relay.c @@ -156,12 +156,10 @@ static void BuildCallFrom16Core( int reg_func, int thunk ) output( "\tandl $0xfff8, %%edx\n" ); output( "\tshrl $1, %%edx\n" ); if (UsePIC) - { - output( "\taddl wine_ldt_copy_ptr-1b(%%ecx),%%edx\n" ); - output( "\tmovl (%%edx), %%edx\n" ); - } + output( "\taddl .Lwine_ldt_copy_ptr-1b(%%ecx),%%edx\n" ); else - output( "\tmovl %s(%%edx), %%edx\n", asm_name("wine_ldt_copy") ); + output( "\taddl .Lwine_ldt_copy_ptr,%%edx\n" ); + output( "\tmovl (%%edx), %%edx\n" ); output( "\tmovzwl %%sp, %%ebp\n" ); output( "\tleal %d(%%ebp,%%edx), %%edx\n", reg_func ? 0 : -4 ); diff --git a/tools/winebuild/spec16.c b/tools/winebuild/spec16.c index 027580b4c47..9dce748dd49 100644 --- a/tools/winebuild/spec16.c +++ b/tools/winebuild/spec16.c @@ -355,11 +355,11 @@ static void output_call16_function( ORDDEF *odp ) if (UsePIC) { output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") ); - output( "1:\tmovl wine_ldt_copy_ptr-1b(%%eax),%%esi\n" ); + output( "1:\tmovl .Lwine_ldt_copy_ptr-1b(%%eax),%%esi\n" ); needs_get_pc_thunk = 1; } else - output( "\tmovl $%s,%%esi\n", asm_name("wine_ldt_copy") ); + output( "\tmovl .Lwine_ldt_copy_ptr,%%esi\n" ); } /* preserve 16-byte stack alignment */ @@ -584,7 +584,7 @@ static void output_module16( DLLSPEC *spec ) output( "\t.short 0,0,0,0\n" ); /* e_res */ output( "\t.short 0\n" ); /* e_oemid */ output( "\t.short 0\n" ); /* e_oeminfo */ - output( "\t.short 0,0,0,0,0,0,0,0,0,0\n" ); /* e_res2 */ + output( ".Lwine_ldt_copy_ptr:\t.long 0,0,0,0,0\n" ); /* e_res2, used for ldt_copy */ output( "\t.long .L__wine_spec_ne_header-.L__wine_spec_dos_header\n" );/* e_lfanew */ output( ".L__wine_spec_ne_header:\n" ); @@ -794,9 +794,6 @@ static void output_module16( DLLSPEC *spec ) output( "\n/* relay functions */\n\n" ); output( "\t.text\n" ); for ( i = 0; i < nb_funcs; i++ ) output_call16_function( typelist[i] ); - output( "\t.data\n" ); - output( "wine_ldt_copy_ptr:\n" ); - output( "\t.long %s\n", asm_name("wine_ldt_copy") ); } free( typelist );