Force as to emit expected CIE/FDE information for x86_64 CPU in .debug_frame section.
This has been unveiled by 425bd55b02e375b9ac8f79b254ce3ca5c9e72719 (before this commit, the .cfi directives where not emitted by winebuild).
x86_64-w64-mingw32-as on x86_64 emits "strange" unwinding information (from winebuild).
00000000 0000000000000014 ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -8 Return address column: 32
DW_CFA_def_cfa: r7 (rsp) ofs 8 DW_CFA_offset: r32 (xmm15) at cfa-8 DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop
Consequence: in unwinding, xmm15 gets updated, but rip isn't, causing an infinite loop in dbghelp.
Wine-Bug-Id: https://bugs.winehq.org/show_bug.cgi?id=55560
Signed-off-by: Eric Pouech epouech@codeweavers.com
From: Eric Pouech epouech@codeweavers.com
Force as to emit expected CIE/FDE information for x86_64 CPU in .debug_frame section.
This has been unveiled by 425bd55b02e375b9ac8f79b254ce3ca5c9e72719 (before this commit, the .cfi directives where not emitted by winebuild).
x86_64-w64-mingw32-as on x86_64 emits "strange" unwinding information (from winebuild).
00000000 0000000000000014 ffffffff CIE Version: 1 Augmentation: "" Code alignment factor: 1 Data alignment factor: -8 Return address column: 32
DW_CFA_def_cfa: r7 (rsp) ofs 8 DW_CFA_offset: r32 (xmm15) at cfa-8 DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop DW_CFA_nop
Consequence: in unwinding, xmm15 gets updated, but rip isn't, causing an infinite loop in dbghelp.
Wine-Bug-Id: https://bugs.winehq.org/show_bug.cgi?id=55560
Signed-off-by: Eric Pouech epouech@codeweavers.com --- tools/winebuild/utils.c | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/tools/winebuild/utils.c b/tools/winebuild/utils.c index 49d2468b236..7c69e71b147 100644 --- a/tools/winebuild/utils.c +++ b/tools/winebuild/utils.c @@ -931,6 +931,15 @@ void output_cfi( const char *format, ... ) va_list valist;
if (!unwind_tables) return; + /* force default registers to avoid gas oddities */ + if (!strcmp(format, ".cfi_startproc") && target.cpu == CPU_x86_64 && is_pe()) + { + fprintf( output_file, "\t.cfi_startproc simple\n"); + fprintf( output_file, "\t.cfi_return_column rip\n"); + fprintf( output_file, "\t.cfi_def_cfa rsp, 8\n"); + fprintf( output_file, "\t.cfi_offset rip, -8\n"); + return; + } va_start( valist, format ); fputc( '\t', output_file ); vfprintf( output_file, format, valist );