From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1184 invoked by alias); 1 Jun 2013 21:35:03 -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 520 invoked by uid 48); 1 Jun 2013 21:34:52 -0000 From: "david.abdurachmanov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/56393] SIGSEGV when -fsanitize=address and dynamic lib with global objects Date: Sat, 01 Jun 2013 21:35:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 4.8.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: david.abdurachmanov at gmail dot com X-Bugzilla-Status: ASSIGNED 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: Message-ID: In-Reply-To: References: 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: 2013-06/txt/msg00036.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56393 --- Comment #25 from David Abdurachmanov --- I downloaded GCC 4.8.1 (final) and binutils 2.23.1 (default ld.gold). The problem is that boost and a lot other C/C++ packages are not compiled w/ ASan. One way would be to guarantee every single C/C++ RPM package correctly compiling w/ ASan (quite some effort). I prefer to instrument the main software (+ some critical C/C++ packages in future) for now. I assume I cannot use -static-libasan for shared objects (-shared) as PREINIT_ARRAY section would be a duplicate. Then -static-libasan should be only used for the final executable binary? I tried something like that: c++ -fsanitize=address -shared -Wl,-E -Wl,-z,defs -Wl,-v ./test.o -o libtest.so -static-libasan I see it doesn't pass to linker: /lib64/libasan_preinit.o -Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic And linker dies w/ undefined references of ASan. Do I need to make sure that **only** executable binaries gets ASan linked statically (-static-libasan)? (Thus they always have PREINIT_ARRAY section initializing ASan). david