From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 24679 invoked by alias); 4 Jan 2013 10:58:29 -0000 Received: (qmail 24641 invoked by uid 48); 4 Jan 2013 10:58:15 -0000 From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/42679] RTLD_DEEPBIND dlopen option for shared library that uses libstdc++ std::ostream crashes Date: Fri, 04 Jan 2013 10:58:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 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 X-SW-Source: 2013-01/txt/msg00291.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42679 --- Comment #21 from Jonathan Wakely 2013-01-04 10:58:11 UTC --- (In reply to comment #19) > (In reply to comment #16) > > I am using "-fpic/-fPIC" and in fact am using: > > // g++ -g -O0 main.cpp -ldl > > // g++ -g -O0 -rdynamic -c -fPIC -o library.o library1.cpp > > // g++ -shared -Wl,-export-dynamic -o library.so library.o > > What if you use -fPIC for the last step? (The manual does say it's necessary > for predictable results when using -shared) As I said previously, the commands above should be using -fPIC when creating the .so, and when I tested it I found that using -fPIC for the first command, i.e. when compiling main.cpp, prevents the crash.