winebuild: Output the asm relay functions as needed and get rid of --relay32 mode.

This commit is contained in:
Alexandre Julliard 2010-01-16 15:50:27 +01:00
parent 102dd9e92f
commit 10e4a55b6c
7 changed files with 18 additions and 44 deletions

View file

@ -56,11 +56,6 @@ C_SRCS = \
RC_SRCS = version.rc RC_SRCS = version.rc
EXTRA_OBJS = relay32.o
@MAKE_DLL_RULES@ @MAKE_DLL_RULES@
relay32.o: $(WINEBUILD)
$(WINEBUILD) $(WINEBUILDFLAGS) -o $@ --relay32
@DEPENDENCIES@ # everything below this line is overwritten by make depend @DEPENDENCIES@ # everything below this line is overwritten by make depend

View file

@ -244,7 +244,8 @@ extern void add_delayed_import( const char *name );
extern void add_ignore_symbol( const char *name ); extern void add_ignore_symbol( const char *name );
extern void add_extra_ld_symbol( const char *name ); extern void add_extra_ld_symbol( const char *name );
extern void read_undef_symbols( DLLSPEC *spec, char **argv ); extern void read_undef_symbols( DLLSPEC *spec, char **argv );
extern int resolve_imports( DLLSPEC *spec ); extern void resolve_imports( DLLSPEC *spec );
extern int is_undefined( const char *name );
extern int has_imports(void); extern int has_imports(void);
extern int has_relays( DLLSPEC *spec ); extern int has_relays( DLLSPEC *spec );
extern void output_get_pc_thunk(void); extern void output_get_pc_thunk(void);
@ -266,6 +267,7 @@ extern void output_bin_res16_directory( DLLSPEC *spec, unsigned int data_offset
extern void output_spec16_file( DLLSPEC *spec ); extern void output_spec16_file( DLLSPEC *spec );
extern void output_fake_module16( DLLSPEC *spec16 ); extern void output_fake_module16( DLLSPEC *spec16 );
extern void output_res_o_file( DLLSPEC *spec ); extern void output_res_o_file( DLLSPEC *spec );
extern void output_asm_relays(void);
extern void BuildRelays16(void); extern void BuildRelays16(void);
extern void BuildRelays32(void); extern void BuildRelays32(void);

View file

@ -585,7 +585,7 @@ void read_undef_symbols( DLLSPEC *spec, char **argv )
} }
/* resolve the imports for a Win32 module */ /* resolve the imports for a Win32 module */
int resolve_imports( DLLSPEC *spec ) void resolve_imports( DLLSPEC *spec )
{ {
int i; int i;
unsigned int j, removed; unsigned int j, removed;
@ -628,8 +628,12 @@ int resolve_imports( DLLSPEC *spec )
sort_names( &undef_symbols ); sort_names( &undef_symbols );
check_undefined_exports( spec ); check_undefined_exports( spec );
}
return 1; /* check if symbol is still undefined */
int is_undefined( const char *name )
{
return find_name( name, &undef_symbols ) != NULL;
} }
/* output the get_pc thunk if needed */ /* output the get_pc thunk if needed */

View file

@ -102,7 +102,6 @@ enum exec_mode_values
MODE_DEF, MODE_DEF,
MODE_IMPLIB, MODE_IMPLIB,
MODE_RELAY16, MODE_RELAY16,
MODE_RELAY32,
MODE_RESOURCES MODE_RESOURCES
}; };
@ -271,7 +270,6 @@ static const char usage_str[] =
" --exe Build a .c file for an executable\n" " --exe Build a .c file for an executable\n"
" --implib Build an import library\n" " --implib Build an import library\n"
" --relay16 Build the 16-bit relay assembly routines\n" " --relay16 Build the 16-bit relay assembly routines\n"
" --relay32 Build the 32-bit relay assembly routines\n"
" --resources Build a .o file for the resource files\n\n" " --resources Build a .o file for the resource files\n\n"
"The mode options are mutually exclusive; you must specify one and only one.\n\n"; "The mode options are mutually exclusive; you must specify one and only one.\n\n";
@ -289,7 +287,6 @@ enum long_options_values
LONG_OPT_NMCMD, LONG_OPT_NMCMD,
LONG_OPT_NXCOMPAT, LONG_OPT_NXCOMPAT,
LONG_OPT_RELAY16, LONG_OPT_RELAY16,
LONG_OPT_RELAY32,
LONG_OPT_RESOURCES, LONG_OPT_RESOURCES,
LONG_OPT_SAVE_TEMPS, LONG_OPT_SAVE_TEMPS,
LONG_OPT_SUBSYSTEM, LONG_OPT_SUBSYSTEM,
@ -312,7 +309,6 @@ static const struct option long_options[] =
{ "nm-cmd", 1, 0, LONG_OPT_NMCMD }, { "nm-cmd", 1, 0, LONG_OPT_NMCMD },
{ "nxcompat", 1, 0, LONG_OPT_NXCOMPAT }, { "nxcompat", 1, 0, LONG_OPT_NXCOMPAT },
{ "relay16", 0, 0, LONG_OPT_RELAY16 }, { "relay16", 0, 0, LONG_OPT_RELAY16 },
{ "relay32", 0, 0, LONG_OPT_RELAY32 },
{ "resources", 0, 0, LONG_OPT_RESOURCES }, { "resources", 0, 0, LONG_OPT_RESOURCES },
{ "save-temps", 0, 0, LONG_OPT_SAVE_TEMPS }, { "save-temps", 0, 0, LONG_OPT_SAVE_TEMPS },
{ "subsystem", 1, 0, LONG_OPT_SUBSYSTEM }, { "subsystem", 1, 0, LONG_OPT_SUBSYSTEM },
@ -507,9 +503,6 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
case LONG_OPT_RELAY16: case LONG_OPT_RELAY16:
set_exec_mode( MODE_RELAY16 ); set_exec_mode( MODE_RELAY16 );
break; break;
case LONG_OPT_RELAY32:
set_exec_mode( MODE_RELAY32 );
break;
case LONG_OPT_RESOURCES: case LONG_OPT_RESOURCES:
set_exec_mode( MODE_RESOURCES ); set_exec_mode( MODE_RESOURCES );
break; break;
@ -671,10 +664,6 @@ int main(int argc, char **argv)
if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] ); if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildRelays16(); BuildRelays16();
break; break;
case MODE_RELAY32:
if (argv[0]) fatal_error( "file argument '%s' not allowed in this mode\n", argv[0] );
BuildRelays32();
break;
case MODE_RESOURCES: case MODE_RESOURCES:
load_resources( argv, spec ); load_resources( argv, spec );
output_res_o_file( spec ); output_res_o_file( spec );

View file

@ -721,7 +721,7 @@ static void BuildCallTo32CBClient( int isEx )
/******************************************************************* /*******************************************************************
* BuildCallFrom32Regs * build_call_from_regs_x86
* *
* Build a 32-bit-to-Wine call-back function for a 'register' function. * Build a 32-bit-to-Wine call-back function for a 'register' function.
* 'args' is the number of dword arguments. * 'args' is the number of dword arguments.
@ -746,7 +746,7 @@ static void BuildCallTo32CBClient( int isEx )
* pointer on return (with the return address and arguments already * pointer on return (with the return address and arguments already
* removed). * removed).
*/ */
static void BuildCallFrom32Regs(void) static void build_call_from_regs_x86(void)
{ {
static const int STACK_SPACE = 128 + 0x2cc /* sizeof(CONTEXT86) */; static const int STACK_SPACE = 128 + 0x2cc /* sizeof(CONTEXT86) */;
@ -962,7 +962,7 @@ void BuildRelays16(void)
output( "\t.text\n" ); output( "\t.text\n" );
output( "%s:\n\n", asm_name("__wine_spec_thunk_text_32") ); output( "%s:\n\n", asm_name("__wine_spec_thunk_text_32") );
BuildCallFrom32Regs(); build_call_from_regs_x86();
output_function_size( "__wine_spec_thunk_text_32" ); output_function_size( "__wine_spec_thunk_text_32" );
output_gnu_stack_note(); output_gnu_stack_note();
@ -1150,34 +1150,21 @@ static void build_call_from_regs_x86_64(void)
/******************************************************************* /*******************************************************************
* BuildRelays32 * output_asm_relays
* *
* Build all the 32-bit relay callbacks * Build all the assembly relay callbacks
*/ */
void BuildRelays32(void) void output_asm_relays(void)
{ {
switch (target_cpu) switch (target_cpu)
{ {
case CPU_x86: case CPU_x86:
output( "/* File generated automatically. Do not edit! */\n\n" ); build_call_from_regs_x86();
output( "\t.text\n" );
output( "%s:\n\n", asm_name("__wine_spec_thunk_text_32") );
/* 32-bit register entry point */
BuildCallFrom32Regs();
output_function_size( "__wine_spec_thunk_text_32" );
output_gnu_stack_note();
break; break;
case CPU_x86_64: case CPU_x86_64:
output( "/* File generated automatically. Do not edit! */\n\n" );
build_call_from_regs_x86_64(); build_call_from_regs_x86_64();
output_gnu_stack_note();
break; break;
default: default:
output( "/* File not used with this architecture. Do not edit! */\n\n" ); break;
return;
} }
} }

View file

@ -554,6 +554,7 @@ void BuildSpec32File( DLLSPEC *spec )
output_stubs( spec ); output_stubs( spec );
output_exports( spec ); output_exports( spec );
output_imports( spec ); output_imports( spec );
if (is_undefined( "__wine_call_from_regs" )) output_asm_relays();
output_resources( spec ); output_resources( spec );
output_gnu_stack_note(); output_gnu_stack_note();
} }

View file

@ -54,10 +54,6 @@ specified via the -E option.
Generate the assembly code for the 16-bit relay routines. This is for Generate the assembly code for the 16-bit relay routines. This is for
Wine internal usage only, you should never need to use this option. Wine internal usage only, you should never need to use this option.
.TP .TP
.B \--relay32
Generate the assembly code for the 32-bit relay routines. This is for
Wine internal usage only, you should never need to use this option.
.TP
.B \--resources .B \--resources
Generate a .o file containing all the input resources. This is useful Generate a .o file containing all the input resources. This is useful
when building with a PE compiler, since the PE binutils cannot handle when building with a PE compiler, since the PE binutils cannot handle