------- Comment #10 from pluto at agmk dot net 2009-03-22 21:17 -------
finally, not a gcc bug.
the mingw-w64-crt/misc/mingw_getsp.S has bugs:
- it forces .code64 even for 32-bit mode.
- it jumps directly into data segement -> jmp (_fctMsvcrtLongJmp)
i've tested following patch:
@@ -3,8 +3,6 @@
* This file is part of the w64 mingw-runtime package.
* No warranty is given; refer to the file DISCLAIMER within this package.
*/
- .file "ceill.S"
- .code64
.text
.align 4
.globl _mingw_getsp
@@ -26,5 +24,5 @@
leaq _fctMsvcrtLongJmp(%rip), %rax
jmpq *(%rax)
#else
- jmp (_fctMsvcrtLongJmp)
+ jmp *(_fctMsvcrtLongJmp)
#endif
but it crashes later in msvcrt.dll:
Breakpoint 1, 0x004023a5 in longjmp ()
(gdb) disassemble
Dump of assembler code for function longjmp:
0x004023a5 <longjmp+0>: jmp *0x405460
0x004023ab <longjmp+6>: nop
(gdb) disassemble *0x405460
Dump of assembler code for function msvcrt!longjmp:
0x77bc7e18 <msvcrt!longjmp+0>: mov 0x4(%esp),%ebx
0x77bc7e1c <msvcrt!longjmp+4>: mov (%ebx),%ebp
0x77bc7e1e <msvcrt!longjmp+6>: mov 0x18(%ebx),%esi
(...)
(gdb) c
Continuing.
Program received signal SIGSEGV, Segmentation fault.
0x77bc6481 in msvcrt!_local_unwind2 () from C:\WINDOWS\syswow64\msvcrt.dll
(gdb) disassemble
Dump of assembler code for function msvcrt!_local_unwind2:
0x77bc645f <msvcrt!_local_unwind2+0>: push %ebx
0x77bc6460 <msvcrt!_local_unwind2+1>: push %esi
0x77bc6461 <msvcrt!_local_unwind2+2>: push %edi
0x77bc6462 <msvcrt!_local_unwind2+3>: mov 0x10(%esp),%eax
0x77bc6466 <msvcrt!_local_unwind2+7>: push %ebp
0x77bc6467 <msvcrt!_local_unwind2+8>: push %eax
0x77bc6468 <msvcrt!_local_unwind2+9>: push $0xfffffffe
0x77bc646a <msvcrt!_local_unwind2+11>: push $0x77bc6424
0x77bc646f <msvcrt!_local_unwind2+16>: pushl %fs:0x0
0x77bc6476 <msvcrt!_local_unwind2+23>: mov %esp,%fs:0x0
0x77bc647d <msvcrt!_local_unwind2+30>: mov 0x24(%esp),%eax
0x77bc6481 <msvcrt!_local_unwind2+34>: mov 0x8(%eax),%ebx
0x77bc6484 <msvcrt!_local_unwind2+37>: mov 0xc(%eax),%esi
0x77bc6487 <msvcrt!_local_unwind2+40>: cmp $0xffffffff,%esi
0x77bc648a <msvcrt!_local_unwind2+43>: je 0x77bc64c1
<msvcrt!_local_unwind2+98>
0x77bc648c <msvcrt!_local_unwind2+45>: cmpl $0xffffffff,0x28(%esp)
0x77bc6491 <msvcrt!_local_unwind2+50>: je 0x77bc6499
<msvcrt!_local_unwind2+58>
0x77bc6493 <msvcrt!_local_unwind2+52>: cmp 0x28(%esp),%esi
0x77bc6497 <msvcrt!_local_unwind2+56>: jbe 0x77bc64c1
<msvcrt!_local_unwind2+98>
0x77bc6499 <msvcrt!_local_unwind2+58>: lea (%esi,%esi,2),%esi
0x77bc649c <msvcrt!_local_unwind2+61>: mov (%ebx,%esi,4),%ecx
0x77bc649f <msvcrt!_local_unwind2+64>: mov %ecx,0x8(%esp)
0x77bc64a3 <msvcrt!_local_unwind2+68>: mov %ecx,0xc(%eax)
0x77bc64a6 <msvcrt!_local_unwind2+71>: cmpl $0x0,0x4(%ebx,%esi,4)
0x77bc64ab <msvcrt!_local_unwind2+76>: jne 0x77bc64bf
<msvcrt!_local_unwind2+96>
0x77bc64ad <msvcrt!_local_unwind2+78>: push $0x101
0x77bc64b2 <msvcrt!_local_unwind2+83>: mov 0x8(%ebx,%esi,4),%eax
0x77bc64b6 <msvcrt!_local_unwind2+87>: call 0x77bc64fb
<msvcrt!_abnormal_termination+44>
0x77bc64bb <msvcrt!_local_unwind2+92>: call *0x8(%ebx,%esi,4)
0x77bc64bf <msvcrt!_local_unwind2+96>: jmp 0x77bc647d
<msvcrt!_local_unwind2+30>
0x77bc64c1 <msvcrt!_local_unwind2+98>: popl %fs:0x0
0x77bc64c8 <msvcrt!_local_unwind2+105>: add $0x10,%esp
0x77bc64cb <msvcrt!_local_unwind2+108>: pop %edi
0x77bc64cc <msvcrt!_local_unwind2+109>: pop %esi
0x77bc64cd <msvcrt!_local_unwind2+110>: pop %ebx
0x77bc64ce <msvcrt!_local_unwind2+111>: ret
--
pluto at agmk dot net changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
Resolution| |INVALID
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39291