From owner-freebsd-bugs@freebsd.org Thu Mar 7 04:04:15 2019 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 05777150CFE3 for ; Thu, 7 Mar 2019 04:04:15 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id 8CB008B27F for ; Thu, 7 Mar 2019 04:04:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id 440D1150CFE2; Thu, 7 Mar 2019 04:04:14 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1E27A150CFE1 for ; Thu, 7 Mar 2019 04:04:14 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A90A58B276 for ; Thu, 7 Mar 2019 04:04:13 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id E5764FB42 for ; Thu, 7 Mar 2019 04:04:12 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id x2744Cxj056957 for ; Thu, 7 Mar 2019 04:04:12 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id x2744Cq5056956 for bugs@FreeBSD.org; Thu, 7 Mar 2019 04:04:12 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 236344] [toolchain] gcc-built shared library crashes in static object constructors when dynamically loaded Date: Thu, 07 Mar 2019 04:04:12 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: misc X-Bugzilla-Version: 11.2-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: yuri@freebsd.org X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Mar 2019 04:04:15 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D236344 Bug ID: 236344 Summary: [toolchain] gcc-built shared library crashes in static object constructors when dynamically loaded Product: Base System Version: 11.2-STABLE Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: misc Assignee: bugs@FreeBSD.org Reporter: yuri@freebsd.org Testcase: the port multimedia/webcamoid with added lines: > WITH_DEBUG=3Dyes > USE_GCC=3Dyes When the executable runs, it crashes with this stack while the plugin is dynamically loaded: > Thread 1 received signal SIGSEGV, Segmentation fault. > 0x00000008056fed78 in vtable for __cxxabiv1::__si_class_type_info () from= /lib/libcxxrt.so.1 > (gdb) bt > #0 0x00000008056fed78 in vtable for __cxxabiv1::__si_class_type_info () = at /lib/libcxxrt.so.1 > #1 0x00000008044ecf86 in __dynamic_cast () at /usr/local/lib/gcc8/libstd= c++.so.6 > #2 0x000000080456bdb0 in bool std::has_facet >(std::loc= ale const&) () at /usr/local/lib/gcc8/libstdc++.so.6 > #3 0x000000080455f154 in std::basic_ios >::= _M_cache_locale(std::locale const&) () at /usr/local/lib/gcc8/libstdc++.so.6 > #4 0x000000080455f5d0 in std::basic_ios >::= init(std::basic_streambuf >*) () > at /usr/local/lib/gcc8/libstdc++.so.6 > #5 0x0000000804500953 in std::ios_base::Init::Init() () at /usr/local/li= b/gcc8/libstdc++.so.6 > #6 0x000000082aab4c56 in __static_initialization_and_destruction_0(int, = int) (__initialize_p=3D1, __priority=3D65535) at /usr/local/lib/gcc8/includ= e/c++/iostream:74 > #7 0x000000082aab4c89 in _GLOBAL__sub_I_ipcbridge.cpp(void) () at src/ip= cbridge.cpp:3411 > #8 0x000000080073a7ab in objlist_call_init (list=3D, lock= state=3D) at /usr/src/libexec/rtld-elf/rtld.c:2657 > #9 0x000000080073f009 in dlopen_object > (name=3D0x80087cc00 "z\270", , fd=3D, refobj=3D, lo_flags=3D10, mode=3D1, lockstate=3D0x= 800000002) > at /usr/src/libexec/rtld-elf/rtld.c:3356 > #10 0x000000080073b836 in rtld_dlopen (name=3D0x80b364e98 "/usr/local/lib= /avkys/libVirtualCamera.so", fd=3D-1, mode=3D) at /usr/src/l= ibexec/rtld-elf/rtld.c:3231 > #11 0x000000080386a7e5 in () at /usr/local/lib/qt5/libQt5Core.so.5 > #12 0x00000008038654ea in () at /usr/local/lib/qt5/libQt5Core.so.5 > #13 0x0000000803865913 in () at /usr/local/lib/qt5/libQt5Core.so.5 > #14 0x00000008009923b2 in AkElement::createPtr(QString const&, QString co= nst&) (pluginId=3D..., elementName=3D...) at src/akelement.cpp:260 > #15 0x0000000800992311 in AkElement::create(QString const&, QString const= &) (pluginId=3D..., elementName=3D...) at src/akelement.cpp:243 > #16 0x0000000000416753 in MediaTools::MediaTools(QObject*) (this=3D0x7fff= ffffe780, parent=3D0x0) at src/mediatools.cpp:95 > #17 0x0000000000415c00 in main(int, char**) (argc=3D1, argv=3D0x7fffffffe= 808) at src/main.cpp:89 > (gdb)=20 The crash occurs during the initialization of this static object: > 74 static ios_base::Init __ioinit; It calls std::ios_base::Init::Init() which has likely been called during the main static constructors invocation, because it generally prints something = from the executable. It looks like the constructor is called twice. The same code works fine when built with clang. --=20 You are receiving this mail because: You are the assignee for the bug.=