Jacek Caban : winebuild: Introduce --safeseh option that allows marking assembly files as SEH compatible.

Alexandre Julliard julliard at winehq.org
Wed May 6 15:34:28 CDT 2020


Module: wine
Branch: master
Commit: e4e05cdaab4044b0e3a66723d51e74daf6a6ac35
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=e4e05cdaab4044b0e3a66723d51e74daf6a6ac35

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Wed May  6 16:18:31 2020 +0200

winebuild: Introduce --safeseh option that allows marking assembly files as SEH compatible.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 tools/winebuild/build.h          | 1 +
 tools/winebuild/main.c           | 7 +++++++
 tools/winebuild/utils.c          | 6 ++++++
 tools/winebuild/winebuild.man.in | 3 +++
 4 files changed, 17 insertions(+)

diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h
index b30785b74a..c162888a03 100644
--- a/tools/winebuild/build.h
+++ b/tools/winebuild/build.h
@@ -364,6 +364,7 @@ extern int link_ext_symbols;
 extern int force_pointer_size;
 extern int unwind_tables;
 extern int unix_lib;
+extern int safe_seh;
 
 extern char *input_file_name;
 extern char *spec_file_name;
diff --git a/tools/winebuild/main.c b/tools/winebuild/main.c
index 47f2787b10..efb86b705e 100644
--- a/tools/winebuild/main.c
+++ b/tools/winebuild/main.c
@@ -47,6 +47,7 @@ int link_ext_symbols = 0;
 int force_pointer_size = 0;
 int unwind_tables = 0;
 int unix_lib = 0;
+int safe_seh = 0;
 
 #ifdef __i386__
 enum target_cpu target_cpu = CPU_x86;
@@ -290,6 +291,7 @@ static const char usage_str[] =
 "   -N, --dll-name=DLLNAME    Set the DLL name (default: from input file name)\n"
 "   -o, --output=NAME         Set the output file name (default: stdout)\n"
 "   -r, --res=RSRC.RES        Load resources from RSRC.RES\n"
+"       --safeseh             Mark object files as SEH compatible\n"
 "       --save-temps          Do not delete the generated intermediate files\n"
 "       --subsystem=SUBSYS    Set the subsystem (one of native, windows, console, wince)\n"
 "   -u, --undefined=SYMBOL    Add an undefined reference to SYMBOL when linking\n"
@@ -324,6 +326,7 @@ enum long_options_values
     LONG_OPT_NMCMD,
     LONG_OPT_NXCOMPAT,
     LONG_OPT_RESOURCES,
+    LONG_OPT_SAFE_SEH,
     LONG_OPT_SAVE_TEMPS,
     LONG_OPT_STATICLIB,
     LONG_OPT_SUBSYSTEM,
@@ -350,6 +353,7 @@ static const struct option long_options[] =
     { "nm-cmd",        1, 0, LONG_OPT_NMCMD },
     { "nxcompat",      1, 0, LONG_OPT_NXCOMPAT },
     { "resources",     0, 0, LONG_OPT_RESOURCES },
+    { "safeseh",       0, 0, LONG_OPT_SAFE_SEH },
     { "save-temps",    0, 0, LONG_OPT_SAVE_TEMPS },
     { "subsystem",     1, 0, LONG_OPT_SUBSYSTEM },
     { "version",       0, 0, LONG_OPT_VERSION },
@@ -543,6 +547,9 @@ static char **parse_options( int argc, char **argv, DLLSPEC *spec )
             if (optarg[0] == 'n' || optarg[0] == 'N')
                 spec->dll_characteristics &= ~IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
             break;
+        case LONG_OPT_SAFE_SEH:
+            safe_seh = 1;
+            break;
         case LONG_OPT_RESOURCES:
             set_exec_mode( MODE_RESOURCES );
             break;
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c
index 669520711c..2a1fc96092 100644
--- a/tools/winebuild/utils.c
+++ b/tools/winebuild/utils.c
@@ -684,6 +684,12 @@ void output_standard_file_header(void)
     else
         output( "/* File generated automatically; do not edit! */\n" );
     output( "/* This file can be copied, modified and distributed without restriction. */\n\n" );
+    if (safe_seh)
+    {
+        output( "\t.def    @feat.00; .scl 3; .type 0; .endef\n" );
+        output( "\t.globl  @feat.00\n" );
+        output( ".set @feat.00, 1\n" );
+    }
 }
 
 /* dump a byte stream into the assembly code */
diff --git a/tools/winebuild/winebuild.man.in b/tools/winebuild/winebuild.man.in
index 9c91c1a504..63ea2a3226 100644
--- a/tools/winebuild/winebuild.man.in
+++ b/tools/winebuild/winebuild.man.in
@@ -219,6 +219,9 @@ and will automatically be handled correctly (though the
 .B \-r
 option will also work for Win32 files).
 .TP
+.B --safeseh
+Mark object files as SEH compatible.
+.TP
 .B --save-temps
 Do not delete the various temporary files that \fBwinebuild\fR generates.
 .TP




More information about the wine-cvs mailing list