From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20186 invoked by alias); 22 Jan 2013 13:35:50 -0000 Received: (qmail 17005 invoked by uid 48); 22 Jan 2013 13:35:30 -0000 From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/55374] [asan] -static-libasan -static-libstdc++ doesn't work Date: Tue, 22 Jan 2013 13: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-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub at gcc dot gnu.org X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: 4.8.0 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/msg02070.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55374 --- Comment #15 from Jakub Jelinek 2013-01-22 13:35:28 UTC --- Created attachment 29249 --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29249 gcc48-pr55374.patch Untested fix. If -static-libasan is missing, it just moves -lasan early on ld command line (before %o, i.e. user input arguments), as we error out on -static and user -Bstatic would go after it, I think it is fine this way. For -static-libasan, we don't pass -lasan at all for -shared (we don't want many (partial) copies of libasan.a in various shared libraries plus executable), and just for executable link with -Bstatic --whole-archive -lasan --no-whole-archive -Bdynamic early on the command line.