winebuild: Use a global flag to determine when to generate the get_pc thunk.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
77a13f69b4
commit
ebb9c5e246
|
@ -284,7 +284,6 @@ extern void read_undef_symbols( DLLSPEC *spec, char **argv );
|
|||
extern void resolve_imports( DLLSPEC *spec );
|
||||
extern int is_undefined( const char *name );
|
||||
extern int has_imports(void);
|
||||
extern int has_relays( DLLSPEC *spec );
|
||||
extern void output_get_pc_thunk(void);
|
||||
extern void output_module( DLLSPEC *spec );
|
||||
extern void output_stubs( DLLSPEC *spec );
|
||||
|
@ -363,5 +362,6 @@ extern struct strarray nm_command;
|
|||
extern char *cpu_option;
|
||||
extern char *arch_option;
|
||||
extern int thumb_mode;
|
||||
extern int needs_get_pc_thunk;
|
||||
|
||||
#endif /* __WINE_BUILD_H */
|
||||
|
|
|
@ -587,8 +587,7 @@ int is_undefined( const char *name )
|
|||
/* output the get_pc thunk if needed */
|
||||
void output_get_pc_thunk(void)
|
||||
{
|
||||
if (target_cpu != CPU_x86) return;
|
||||
if (!UsePIC) return;
|
||||
assert( target_cpu == CPU_x86 );
|
||||
output( "\n\t.text\n" );
|
||||
output( "\t.align %d\n", get_alignment(4) );
|
||||
output( "\t%s\n", func_declaration("__wine_spec_get_pc_thunk_eax") );
|
||||
|
@ -619,6 +618,7 @@ static void output_import_thunk( const char *name, const char *table, int pos )
|
|||
{
|
||||
output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
|
||||
output( "1:\tjmp *%s+%d-1b(%%eax)\n", table, pos );
|
||||
needs_get_pc_thunk = 1;
|
||||
}
|
||||
break;
|
||||
case CPU_x86_64:
|
||||
|
@ -1189,6 +1189,7 @@ void output_stubs( DLLSPEC *spec )
|
|||
{
|
||||
output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
|
||||
output( "1:" );
|
||||
needs_get_pc_thunk = 1;
|
||||
if (exp_name)
|
||||
{
|
||||
output( "\tleal .L%s_string-1b(%%eax),%%ecx\n", name );
|
||||
|
@ -1291,14 +1292,6 @@ void output_imports( DLLSPEC *spec )
|
|||
output_immediate_import_thunks();
|
||||
output_delayed_import_thunks( spec );
|
||||
output_external_link_imports( spec );
|
||||
if (!list_empty( &dll_imports ) ||
|
||||
!list_empty( &dll_delayed ) ||
|
||||
ext_link_imports.count ||
|
||||
has_stubs(spec) ||
|
||||
has_relays(spec))
|
||||
{
|
||||
output_get_pc_thunk();
|
||||
}
|
||||
}
|
||||
|
||||
/* output an import library for a Win32 module and additional object files */
|
||||
|
|
|
@ -356,6 +356,7 @@ static void output_call16_function( ORDDEF *odp )
|
|||
{
|
||||
output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
|
||||
output( "1:\tmovl wine_ldt_copy_ptr-1b(%%eax),%%esi\n" );
|
||||
needs_get_pc_thunk = 1;
|
||||
}
|
||||
else
|
||||
output( "\tmovl $%s,%%esi\n", asm_name("wine_ldt_copy") );
|
||||
|
@ -814,6 +815,7 @@ void output_spec16_file( DLLSPEC *spec16 )
|
|||
resolve_imports( spec16 );
|
||||
add_16bit_exports( spec32, spec16 );
|
||||
|
||||
needs_get_pc_thunk = 0;
|
||||
output_standard_file_header();
|
||||
output_module( spec32 );
|
||||
output_module16( spec16 );
|
||||
|
@ -821,6 +823,7 @@ void output_spec16_file( DLLSPEC *spec16 )
|
|||
output_exports( spec32 );
|
||||
output_imports( spec16 );
|
||||
if (is_undefined( "__wine_call_from_16" )) output_asm_relays16();
|
||||
if (needs_get_pc_thunk) output_get_pc_thunk();
|
||||
if (spec16->main_module)
|
||||
{
|
||||
output( "\n\t%s\n", get_asm_string_section() );
|
||||
|
|
|
@ -46,6 +46,8 @@
|
|||
#define IMAGE_NT_OPTIONAL_HDR64_MAGIC 0x20b
|
||||
#define IMAGE_ROM_OPTIONAL_HDR_MAGIC 0x107
|
||||
|
||||
int needs_get_pc_thunk = 0;
|
||||
|
||||
/* check if entry point needs a relay thunk */
|
||||
static inline int needs_relay( const ORDDEF *odp )
|
||||
{
|
||||
|
@ -78,7 +80,7 @@ static int is_float_arg( const ORDDEF *odp, int arg )
|
|||
}
|
||||
|
||||
/* check if dll will output relay thunks */
|
||||
int has_relays( DLLSPEC *spec )
|
||||
static int has_relays( DLLSPEC *spec )
|
||||
{
|
||||
int i;
|
||||
|
||||
|
@ -189,6 +191,7 @@ static void output_relay_debug( DLLSPEC *spec )
|
|||
{
|
||||
output( "\tcall %s\n", asm_name("__wine_spec_get_pc_thunk_eax") );
|
||||
output( "1:\tleal .L__wine_spec_relay_descr-1b(%%eax),%%eax\n" );
|
||||
needs_get_pc_thunk = 1;
|
||||
}
|
||||
else output( "\tmovl $.L__wine_spec_relay_descr,%%eax\n" );
|
||||
output( "\tpushl %%eax\n" );
|
||||
|
@ -616,6 +619,7 @@ void output_module( DLLSPEC *spec )
|
|||
*/
|
||||
void BuildSpec32File( DLLSPEC *spec )
|
||||
{
|
||||
needs_get_pc_thunk = 0;
|
||||
resolve_imports( spec );
|
||||
output_standard_file_header();
|
||||
output_module( spec );
|
||||
|
@ -623,6 +627,7 @@ void BuildSpec32File( DLLSPEC *spec )
|
|||
output_exports( spec );
|
||||
output_imports( spec );
|
||||
if (is_undefined( "__wine_call_from_regs" )) output_asm_relays();
|
||||
if (needs_get_pc_thunk) output_get_pc_thunk();
|
||||
output_resources( spec );
|
||||
output_gnu_stack_note();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue