Bug 57680 - [META-BUG][target]deregister_frame_fn is set to invalid address in cygming-crtbegin.c:__gcc_deregister_frame due to unknown reason.
Summary: [META-BUG][target]deregister_frame_fn is set to invalid address in cygming-cr...
Status: RESOLVED FIXED
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.9.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-23 03:20 UTC by gee
Modified: 2013-11-11 10:12 UTC (History)
1 user (show)

See Also:
Host: i686-pc-cygwin
Target: i686-pc-cygwin
Build: i686-pc-cygwin
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description gee 2013-06-23 03:20:19 UTC
$ gdb --args ./xgcc -B./ -B/usr/i686-pc-cygwin/bin/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -L/tmp/gcc/host-i686-pc-cygwin/gcc/../ld -dumpspecs
GNU gdb (GDB) 7.6.50.20130508-cvs (cygwin-special)
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "i686-cygwin".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...

warning: the current range check setting does not match the language.

Whether backtraces should continue past the entry point of a program is off.
Reading symbols from /tmp/gcc/host-i686-pc-cygwin/gcc/xgcc...done.
warning: File "/tmp/gcc/host-i686-pc-cygwin/gcc/.gdbinit" auto-loading has been declined by your `auto-load safe-path' set to "$debugdir:$datadir/auto-load".
To enable execution of this file add
        add-auto-load-safe-path /tmp/gcc/host-i686-pc-cygwin/gcc/.gdbinit
line to your configuration file "/home/Administrator/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/Administrator/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
(gdb) r
Starting program: /tmp/gcc/host-i686-pc-cygwin/gcc/xgcc -B./ -B/usr/i686-pc-cygwin/bin/ -isystem /usr/i686-pc-cygwin/include -isystem /usr/i686-pc-cygwin/sys-include -L/tmp/gcc/host-i686-pc-cygwin/gcc/../ld -dumpspecs
[New Thread 3320.0xdf4]
warning: the debug information found in "/usr/bin/cygwin1.dbg" does not match "/usr/bin/cygwin1.dll" (CRC mismatch).

[New Thread 3320.0x1dc8]
*asm:

.....
......
.......

Program received signal SIGILL, Illegal instruction.
0x0046e010 in __deregister_frame_info_bases (
    begin=0x611623b5 <__call_exitprocs+245>)
    at ../.././libgcc/unwind-dw2-fde.c:185
185       for (p = &unseen_objects; *p ; p = &(*p)->next)
(gdb) bt
#0  0x0046e010 in __deregister_frame_info_bases (
    begin=0x611623b5 <__call_exitprocs+245>)
    at ../.././libgcc/unwind-dw2-fde.c:185
#1  0x013aa8e8 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Comment 1 gee 2013-06-23 03:43:53 UTC
bootstrap failed with faulting libgcc static library.

Dump of assembler code for function __gcc_deregister_frame:
   0x00401160 <+0>:     push   %ebp
   0x00401161 <+1>:     mov    %esp,%ebp
   0x00401163 <+3>:     sub    $0x18,%esp
   0x00401166 <+6>:     movl   $0x475000,(%esp)
   0x0040116d <+13>:    call   *0x5a0480
   0x00401173 <+19>:    mov    $0x46e010,%edx
=> 0x00401178 <+24>:    sub    $0x4,%esp
   0x0040117b <+27>:    test   %eax,%eax
   0x0040117d <+29>:    je     0x401195 <__gcc_deregister_frame+53>
   0x0040117f <+31>:    movl   $0x475047,0x4(%esp)
   0x00401187 <+39>:    mov    %eax,(%esp)
   0x0040118a <+42>:    call   *0x5a0484
   0x00401190 <+48>:    sub    $0x8,%esp
   0x00401193 <+51>:    mov    %eax,%edx
   0x00401195 <+53>:    test   %edx,%edx
   0x00401197 <+55>:    je     0x4011a2 <__gcc_deregister_frame+66>
   0x00401199 <+57>:    movl   $0x591000,(%esp)
   0x004011a0 <+64>:    call   *%edx
   0x004011a2 <+66>:    leave
   0x004011a3 <+67>:    ret
(gdb) i li *0x46e010
Line 185 of "../.././libgcc/unwind-dw2-fde.c"
   starts at address 0x46e00f <__deregister_frame_info_bases+159>
   and ends at 0x46e020 <__deregister_frame_info>.

why cygming-crtbegin.c:154 set invalid function pointer address??? it should be __deregister_frame_info 
(gdb) x/i __deregister_frame_info
   0x46e020 <__deregister_frame_info>:
    jmp    0x46df70 <__deregister_frame_info_bases>

i think gcc is corrupted in calculating function pointer address.
and the failed bootstrap was using gcc with following version.
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/i686-pc-cygwin/4.9.0/lto-wrapper.exe
Target: i686-pc-cygwin
Configured with: ./configure --config-cache --prefix=/usr --disable-win32-registry --enable-threads=single --enable-languages=c,c++,lto,fortran --with-win32-nlsapi=unicode --enable-tls --disable-bootstrap --enable-shared --disable-sjlj-exceptions --enable-gomp --enable-cloog-backend=isl LTLDFLAGS=-no-undefined lt_cv_deplibs_check_method=pass_all : (reconfigured) ./configure --config-cache --prefix=/usr --disable-win32-registry --enable-threads=win32 --with-win32-nlsapi=unicode --enable-tls --disable-bootstrap --enable-shared --disable-sjlj-exceptions --enable-gomp --enable-cloog-backend=isl LTLDFLAGS=-no-undefined lt_cv_deplibs_check_method=pass_all --enable-languages=c,c++,fortran,lto --no-create --no-recursion
Thread model: single
gcc version 4.9.0 20130516 (experimental) (GCC)
Comment 2 gee 2013-06-23 03:46:14 UTC
(gdb) x/i 0x46e010
   0x46e010 <__deregister_frame_info_bases+160>:        fs

which is cause of SIGILL
Comment 3 Jean-Pierre Flori 2013-11-08 13:56:39 UTC
This looks like the problem reported here:
* http://cygwin.com/ml/cygwin/2013-08/msg00201.html
* ​http://cygwin.com/ml/cygwin/2013-07/msg00528.html 
Note that an explanation and a fix are also provided there.
This also affects 4.7.3.
Comment 4 gee 2013-11-08 19:49:04 UTC
I think gcc backend for x86 that doesn't support weak attribute needed to supress weak attribute on variables as long as gas/16011 is not fixed.
Comment 5 Kai Tietz 2013-11-11 10:12:54 UTC
The reason is pretty obvious ... see pr 57982.  Fix was applied to all open branches.

Weak works on pe-coff different, and there seem to be inconsistencies, but this issue isn't related to this at all.