Module: wine Branch: master Commit: 40c1c498a990a835cedee2d8db6fe6a0a5c114f7 URL: https://gitlab.winehq.org/wine/wine/-/commit/40c1c498a990a835cedee2d8db6fe6a...
Author: Alexandre Julliard julliard@winehq.org Date: Tue Sep 19 13:02:21 2023 +0200
winebuild: Add a few more SEH annotations.
---
tools/winebuild/import.c | 22 ++++++++++++++++++++-- tools/winebuild/spec32.c | 3 +++ 2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/tools/winebuild/import.c b/tools/winebuild/import.c index 7f817990c44..75e4dacf871 100644 --- a/tools/winebuild/import.c +++ b/tools/winebuild/import.c @@ -1307,8 +1307,11 @@ void output_stubs( DLLSPEC *spec ) break; case CPU_x86_64: output_cfi( ".cfi_startproc" ); + output_seh( ".seh_proc %s", asm_name(name) ); output( "\tsubq $0x28,%%rsp\n" ); - output_cfi( ".cfi_adjust_cfa_offset 8" ); + output_cfi( ".cfi_adjust_cfa_offset 0x28" ); + output_seh( ".seh_stackalloc 0x28" ); + output_seh( ".seh_endprologue" ); output( "\tleaq .L__wine_spec_file_name(%%rip),%%rcx\n" ); if (exp_name) output( "leaq .L%s_string(%%rip),%%rdx\n", name ); @@ -1316,6 +1319,7 @@ void output_stubs( DLLSPEC *spec ) output( "\tmovq $%d,%%rdx\n", odp->ordinal ); output( "\tcall %s\n", asm_name("__wine_spec_unimplemented_stub") ); output_cfi( ".cfi_endproc" ); + output_seh( ".seh_endproc" ); break; case CPU_ARM: if (UsePIC) @@ -1343,6 +1347,8 @@ void output_stubs( DLLSPEC *spec ) } break; case CPU_ARM64: + output_seh( ".seh_proc %s", asm_name(name) ); + output_seh( ".seh_endprologue" ); output( "\tadrp x0, %s\n", arm64_page(".L__wine_spec_file_name") ); output( "\tadd x0, x0, #%s\n", arm64_pageoff(".L__wine_spec_file_name") ); if (exp_name) @@ -1354,7 +1360,8 @@ void output_stubs( DLLSPEC *spec ) } else output( "\tmov x1, %u\n", odp->ordinal ); - output( "\tbl %s\n", asm_name("__wine_spec_unimplemented_stub") ); + output( "\tb %s\n", asm_name("__wine_spec_unimplemented_stub") ); + output_seh( ".seh_endproc" ); break; default: assert(0); @@ -1436,6 +1443,8 @@ void output_syscalls( DLLSPEC *spec ) output( "\tret $%u\n", get_args_size( odp )); break; case CPU_x86_64: + output_seh( ".seh_proc %s", asm_name(name) ); + output_seh( ".seh_endprologue" ); /* Chromium depends on syscall thunks having the same form as on * Windows. For 64-bit systems the only viable form we can emulate is * having an int $0x2e fallback. Since actually using an interrupt is @@ -1461,6 +1470,7 @@ void output_syscalls( DLLSPEC *spec ) output( "1:\tcallq *%s(%%rip)\n", asm_name("__wine_syscall_dispatcher") ); } output( "\tret\n" ); + output_seh( ".seh_endproc" ); break; case CPU_ARM: output( "\tpush {r0-r3}\n" ); @@ -1470,10 +1480,13 @@ void output_syscalls( DLLSPEC *spec ) output( "\tbx lr\n" ); break; case CPU_ARM64: + output_seh( ".seh_proc %s", asm_name(name) ); + output_seh( ".seh_endprologue" ); output( "\tmov x8, #%u\n", id ); output( "\tmov x9, x30\n" ); output( "\tbl %s\n", asm_name("__wine_syscall" )); output( "\tret\n" ); + output_seh( ".seh_endproc" ); break; default: assert(0); @@ -1724,8 +1737,12 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struc output( "1:\t.long %s\n", asm_name( import_desc ) ); break; case CPU_ARM64: + output_seh( ".seh_proc %s", asm_name( delay_load ) ); output( "\tstp x29, x30, [sp, #-80]!\n" ); + output_seh( ".seh_save_fplr_x 80" ); output( "\tmov x29, sp\n" ); + output_seh( ".seh_set_fp" ); + output_seh( ".seh_endprologue" ); output( "\tstp x0, x1, [sp, #16]\n" ); output( "\tstp x2, x3, [sp, #32]\n" ); output( "\tstp x4, x5, [sp, #48]\n" ); @@ -1741,6 +1758,7 @@ static void build_windows_import_lib( const char *lib_name, DLLSPEC *spec, struc output( "\tldp x6, x7, [sp, #64]\n" ); output( "\tldp x29, x30, [sp], #80\n" ); output( "\tbr x16\n" ); + output_seh( ".seh_endproc" ); break; } output_function_size( delay_load ); diff --git a/tools/winebuild/spec32.c b/tools/winebuild/spec32.c index 96f1875da38..c4267d7bba1 100644 --- a/tools/winebuild/spec32.c +++ b/tools/winebuild/spec32.c @@ -369,6 +369,8 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\t.align %d\n", get_alignment(4) ); output( "\t.long 0x90909090,0x90909090\n" ); output( "__wine_spec_relay_entry_point_%d:\n", i ); + output_seh( ".seh_proc __wine_spec_relay_entry_point_%d", i ); + output_seh( ".seh_endprologue" ); switch (odp->u.func.nb_args) { default: output( "\tmovq %%%s,32(%%rsp)\n", is_float_arg( odp, 3 ) ? "xmm3" : "r9" ); @@ -385,6 +387,7 @@ static void output_relay_debug( DLLSPEC *spec ) output( "\tleaq .L__wine_spec_relay_descr(%%rip),%%rcx\n" ); output( "\tcallq *8(%%rcx)\n" ); output( "\tret\n" ); + output_seh( ".seh_endproc" ); break;
default: