From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28568 invoked by alias); 8 Jul 2014 16:58:30 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 28261 invoked by uid 48); 8 Jul 2014 16:58:17 -0000 From: "jon.turney at dronecode dot org.uk" To: gcc-bugs@gcc.gnu.org Subject: [Bug libgcc/61752] New: on cygwin, aborts during exit() with a dynamically loaded C++ library Date: Tue, 08 Jul 2014 16:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libgcc X-Bugzilla-Version: 4.8.3 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jon.turney at dronecode dot org.uk X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter cf_gcctarget Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2014-07/txt/msg00488.txt.bz2 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61752 Bug ID: 61752 Summary: on cygwin, aborts during exit() with a dynamically loaded C++ library Product: gcc Version: 4.8.3 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: jon.turney at dronecode dot org.uk Target: i686-pc-cygwin There seems to be a problem somehow related to having a C++ library which does depend on libgcc dynamically loaded by a C program which doesn't depend on libgcc, where abort is being called during exit() This seems to be specific to x86 cygwin/mingw targets with dw2 eh test.c: #include #include int main() { void *h = dlopen("dllib.dll", 0); assert(h); dlclose(h); } dllib.c: #include std::fstream instance; Makefile: all: g++ -g -O0 -c dllib.cc g++ -g -O0 -shared -o dllib.dll dllib.o gcc -g -O0 -o test.exe test.c ./test Running under gdb shows gcc_abort() in __deregister_frame_info_bases() is being hit $ gdb test [...] Program received signal SIGABRT, Aborted. 0x0028da18 in ?? () (gdb) bt #0 0x0028da18 in ?? () #1 0x74f912cc in WriteFile () from /cygdrive/c/Windows/syswow64/kernel32.dll #2 0x610da70c in sig_send(_pinfo*, siginfo_t&, _cygtls*)@12 (p=p@entry=0x60fd0000, si=..., tls=tls@entry=0x0) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/sigproc.cc:638 #3 0x610d7dbc in _pinfo::kill(siginfo_t&)@8 (this=0x60fd0000, si=...) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/signal.cc:248 #4 0x610d8286 in kill0 (pid=pid@entry=5044, si=...) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/signal.cc:299 #5 0x610d8452 in kill (sig=sig@entry=6, pid=5044) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/signal.cc:308 #6 raise (sig=sig@entry=6) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/signal.cc:284 #7 0x610d86f3 in abort () at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/signal.cc:371 #8 0x699134d1 in __deregister_frame_info_bases (begin=0x404038 <__EH_FRAME_BEGIN__>) at /usr/src/debug/gcc-4.8.3-1/libgcc/unwind-dw2-fde.c:216 #9 0x00401182 in __gcc_deregister_frame () #10 0x61006466 in do_global_dtors () at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/dcrt0.cc:62 #11 0x61159aba in __call_exitprocs (code=code@entry=0, d=d@entry=0x0) at /usr/src/debug/cygwin-1.7.30-1/newlib/libc/stdlib/__call_atexit.c:118 #12 0x611305d8 in exit (code=0) at /usr/src/debug/cygwin-1.7.30-1/newlib/libc/stdlib/exit.c:66 #13 0x61006b39 in cygwin_exit (n=0) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/dcrt0.cc:1248 #14 0x61008041 in cygwin_exit_return () at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/dcrt0.cc:1041 #15 0x61005e84 in _cygtls::call2(unsigned long (*)(void*, void*), void*, void*)@16 (this=, func=func@entry=0x610071d0 , arg=arg@entry=0x0, buf=buf@entry=0x28cd84) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/cygtls.cc:100 #16 0x61005ff6 in _cygtls::call (func=func@entry=0x610071d0 , arg=arg@entry=0x0) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/cygtls.cc:30 #17 0x61006f54 in _dll_crt0@0 () at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/dcrt0.cc:1098 #18 0x00401222 in cygwin_crt0 (f=0x4011a0
) at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/lib/cygwin_crt0.c:22 #19 0x00401015 in mainCRTStartup () at /usr/src/debug/cygwin-1.7.30-1/winsup/cygwin/crt0.c:29