diff --git a/tools/winebuild/build.h b/tools/winebuild/build.h index b30785b74a3..c162888a035 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 47f2787b10c..efb86b705e1 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 669520711c2..2a1fc960926 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 9c91c1a5047..63ea2a32269 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