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

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jacek Caban 2020-05-06 16:18:31 +02:00 committed by Alexandre Julliard
parent 35242aa417
commit e4e05cdaab
4 changed files with 17 additions and 0 deletions

View File

@ -364,6 +364,7 @@ extern int link_ext_symbols;
extern int force_pointer_size; extern int force_pointer_size;
extern int unwind_tables; extern int unwind_tables;
extern int unix_lib; extern int unix_lib;
extern int safe_seh;
extern char *input_file_name; extern char *input_file_name;
extern char *spec_file_name; extern char *spec_file_name;

View File

@ -47,6 +47,7 @@ int link_ext_symbols = 0;
int force_pointer_size = 0; int force_pointer_size = 0;
int unwind_tables = 0; int unwind_tables = 0;
int unix_lib = 0; int unix_lib = 0;
int safe_seh = 0;
#ifdef __i386__ #ifdef __i386__
enum target_cpu target_cpu = CPU_x86; 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" " -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" " -o, --output=NAME Set the output file name (default: stdout)\n"
" -r, --res=RSRC.RES Load resources from RSRC.RES\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" " --save-temps Do not delete the generated intermediate files\n"
" --subsystem=SUBSYS Set the subsystem (one of native, windows, console, wince)\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" " -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_NMCMD,
LONG_OPT_NXCOMPAT, LONG_OPT_NXCOMPAT,
LONG_OPT_RESOURCES, LONG_OPT_RESOURCES,
LONG_OPT_SAFE_SEH,
LONG_OPT_SAVE_TEMPS, LONG_OPT_SAVE_TEMPS,
LONG_OPT_STATICLIB, LONG_OPT_STATICLIB,
LONG_OPT_SUBSYSTEM, LONG_OPT_SUBSYSTEM,
@ -350,6 +353,7 @@ 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 },
{ "resources", 0, 0, LONG_OPT_RESOURCES }, { "resources", 0, 0, LONG_OPT_RESOURCES },
{ "safeseh", 0, 0, LONG_OPT_SAFE_SEH },
{ "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 },
{ "version", 0, 0, LONG_OPT_VERSION }, { "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') if (optarg[0] == 'n' || optarg[0] == 'N')
spec->dll_characteristics &= ~IMAGE_DLLCHARACTERISTICS_NX_COMPAT; spec->dll_characteristics &= ~IMAGE_DLLCHARACTERISTICS_NX_COMPAT;
break; break;
case LONG_OPT_SAFE_SEH:
safe_seh = 1;
break;
case LONG_OPT_RESOURCES: case LONG_OPT_RESOURCES:
set_exec_mode( MODE_RESOURCES ); set_exec_mode( MODE_RESOURCES );
break; break;

View File

@ -684,6 +684,12 @@ void output_standard_file_header(void)
else else
output( "/* File generated automatically; do not edit! */\n" ); output( "/* File generated automatically; do not edit! */\n" );
output( "/* This file can be copied, modified and distributed without restriction. */\n\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 */ /* dump a byte stream into the assembly code */

View File

@ -219,6 +219,9 @@ and will automatically be handled correctly (though the
.B \-r .B \-r
option will also work for Win32 files). option will also work for Win32 files).
.TP .TP
.B --safeseh
Mark object files as SEH compatible.
.TP
.B --save-temps .B --save-temps
Do not delete the various temporary files that \fBwinebuild\fR generates. Do not delete the various temporary files that \fBwinebuild\fR generates.
.TP .TP