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

Alexandre Julliard julliard at winehq.org
Mon Jan 18 10:58:50 CST 2010


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Sat Jan 16 15:50:27 2010 +0100

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

---

 dlls/ntdll/Makefile.in           |    5 -----
 tools/winebuild/build.h          |    4 +++-
 tools/winebuild/import.c         |    8 ++++++--
 tools/winebuild/main.c           |   11 -----------
 tools/winebuild/relay.c          |   29 ++++++++---------------------
 tools/winebuild/spec32.c         |    1 +
 tools/winebuild/winebuild.man.in |    4 ----
 7 files changed, 18 insertions(+), 44 deletions(-)

diff --git a/dlls/ntdll/Makefile.in b/dlls/ntdll/Makefile.in
index a372044..41bc5d3 100644
--- a/dlls/ntdll/Makefile.in
+++ b/dlls/ntdll/Makefile.in
@@ -56,11 +56,6 @@ C_SRCS = \
 
 RC_SRCS = version.rc
 
-EXTRA_OBJS = relay32.o
-
 @MAKE_DLL_RULES@
 
-relay32.o: $(WINEBUILD)
-	$(WINEBUILD) $(WINEBUILDFLAGS) -o $@ --relay32
-
 @DEPENDENCIES@  # everything below this line is overwritten by make depend
diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index 06e2887..23b9bd1 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -244,7 +244,8 @@ extern void add_delayed_import( const char *name );
 extern void add_ignore_symbol( const char *name );
 extern void add_extra_ld_symbol( const char *name );
 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_relays( DLLSPEC *spec );
 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_fake_module16( DLLSPEC *spec16 );
 extern void output_res_o_file( DLLSPEC *spec );
+extern void output_asm_relays(void);
 
 extern void BuildRelays16(void);
 extern void BuildRelays32(void);
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c
index e5e87d3..dc703f1 100644
--- a/tools/winebuild/import.c
+++ b/tools/winebuild/import.c
@@ -585,7 +585,7 @@ void read_undef_symbols( DLLSPEC *spec, char **argv )
 }
 
 /* resolve the imports for a Win32 module */
-int resolve_imports( DLLSPEC *spec )
+void resolve_imports( DLLSPEC *spec )
 {
     int i;
     unsigned int j, removed;
@@ -628,8 +628,12 @@ int resolve_imports( DLLSPEC *spec )
 
     sort_names( &undef_symbols );
     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 */
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index aa487ef..2563d53 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -102,7 +102,6 @@ enum exec_mode_values
     MODE_DEF,
     MODE_IMPLIB,
     MODE_RELAY16,
-    MODE_RELAY32,
     MODE_RESOURCES
 };
 
@@ -271,7 +270,6 @@ static const char usage_str[] =
 "       --exe                 Build a .c file for an executable\n"
 "       --implib              Build an import library\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"
 "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_NXCOMPAT,
     LONG_OPT_RELAY16,
-    LONG_OPT_RELAY32,
     LONG_OPT_RESOURCES,
     LONG_OPT_SAVE_TEMPS,
     LONG_OPT_SUBSYSTEM,
@@ -312,7 +309,6 @@ static const struct option long_options[] =
     { "nm-cmd",        1, 0, LONG_OPT_NMCMD },
     { "nxcompat",      1, 0, LONG_OPT_NXCOMPAT },
     { "relay16",       0, 0, LONG_OPT_RELAY16 },
-    { "relay32",       0, 0, LONG_OPT_RELAY32 },
     { "resources",     0, 0, LONG_OPT_RESOURCES },
     { "save-temps",    0, 0, LONG_OPT_SAVE_TEMPS },
     { "subsystem",     1, 0, LONG_OPT_SUBSYSTEM },
@@ -507,9 +503,6 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
         case LONG_OPT_RELAY16:
             set_exec_mode( MODE_RELAY16 );
             break;
-        case LONG_OPT_RELAY32:
-            set_exec_mode( MODE_RELAY32 );
-            break;
         case LONG_OPT_RESOURCES:
             set_exec_mode( MODE_RESOURCES );
             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] );
         BuildRelays16();
         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:
         load_resources( argv, spec );
         output_res_o_file( spec );
diff --git a/tools/winebuild/relay.c b/tools/winebuild/relay.c
index 64bb2d5..221fc5a 100644
--- a/tools/winebuild/relay.c
+++ b/tools/winebuild/relay.c
@@ -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.
  * '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
  * removed).
  */
-static void BuildCallFrom32Regs(void)
+static void build_call_from_regs_x86(void)
 {
     static const int STACK_SPACE = 128 + 0x2cc /* sizeof(CONTEXT86) */;
 
@@ -962,7 +962,7 @@ void BuildRelays16(void)
 
     output( "\t.text\n" );
     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_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)
     {
     case CPU_x86:
-        output( "/* File generated automatically. Do not edit! */\n\n" );
-        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();
+        build_call_from_regs_x86();
         break;
-
     case CPU_x86_64:
-        output( "/* File generated automatically. Do not edit! */\n\n" );
         build_call_from_regs_x86_64();
-        output_gnu_stack_note();
         break;
-
     default:
-        output( "/* File not used with this architecture. Do not edit! */\n\n" );
-        return;
+        break;
     }
 }
diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c
index a594deb..3152660 100644
--- a/tools/winebuild/spec32.c
+++ b/tools/winebuild/spec32.c
@@ -554,6 +554,7 @@ void BuildSpec32File( DLLSPEC *spec )
     output_stubs( spec );
     output_exports( spec );
     output_imports( spec );
+    if (is_undefined( "__wine_call_from_regs" )) output_asm_relays();
     output_resources( spec );
     output_gnu_stack_note();
 }
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index 7ca151c..4897290 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -54,10 +54,6 @@ specified via the -E option.
 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.
 .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
 Generate a .o file containing all the input resources. This is useful
 when building with a PE compiler, since the PE binutils cannot handle




More information about the wine-cvs mailing list