From patchwork Sat Nov 17 23:42:48 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 199889 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id CCDEE2C008C for ; Sun, 18 Nov 2012 10:43:00 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1353800581; h=Comment: DomainKey-Signature:Received:Received:Received:Received: MIME-Version:Received:Received:In-Reply-To:References:Date: Message-ID:Subject:From:To:Cc:Content-Type:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=71OURtfT3U5a+uv+CFnNmyIH6+A=; b=LT26THA0HwXOUqN2VerUd+wBBlQvZLnYia8eyuSr8fvwPJDSUv9SEIxtIGJM50 QdRwSvsgNawQYKUjlxqUInZ8eIY1cnHbbaYHPU2p1uvyaMfxSb2ETDW/EKwc73jp p0n6JUPMovfoweXPE655xW1CxdmexqpbUqSgnlD7aO0n0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:MIME-Version:Received:Received:In-Reply-To:References:Date:Message-ID:Subject:From:To:Cc:Content-Type:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=Bqalz3XSGTZ66BGRnaCNjrg6fg7XkLYC9wnywnV4OgGp93AiSYKLtDnYHijA3f didr/uKKQIuJfPDXgOCjSR3qB+4nleNcivTLVscvklrFlPOkuPNcawflbagz0Dxu S6qIb8nN7FgWTuxw4+A/sAWWAfZefwnuM/S2EGEYSsvNQ=; Received: (qmail 19425 invoked by alias); 17 Nov 2012 23:42:55 -0000 Received: (qmail 19384 invoked by uid 22791); 17 Nov 2012 23:42:54 -0000 X-SWARE-Spam-Status: No, hits=-3.8 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-qc0-f175.google.com (HELO mail-qc0-f175.google.com) (209.85.216.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 17 Nov 2012 23:42:48 +0000 Received: by mail-qc0-f175.google.com with SMTP id j3so2654818qcs.20 for ; Sat, 17 Nov 2012 15:42:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.49.13.202 with SMTP id j10mr9180712qec.27.1353195768203; Sat, 17 Nov 2012 15:42:48 -0800 (PST) Received: by 10.49.12.116 with HTTP; Sat, 17 Nov 2012 15:42:48 -0800 (PST) In-Reply-To: <20121117202211.GA2315@tucnak.redhat.com> References: <20121117200000.GA1016@gmail.com> <20121117202211.GA2315@tucnak.redhat.com> Date: Sat, 17 Nov 2012 15:42:48 -0800 Message-ID: Subject: Re: PATCH: Add -static-libasan to the GCC driver From: "H.J. Lu" To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Sat, Nov 17, 2012 at 12:22 PM, Jakub Jelinek wrote: > On Sat, Nov 17, 2012 at 12:00:00PM -0800, H.J. Lu wrote: >> This patch adds -static-libasan. OK to install? > > Okay, thanks. > >> 2012-11-17 H.J. Lu >> >> * common.opt (static-libasan): New option. >> * gcc.c (LIBASAN_SPEC): New macro. >> (LINK_COMMAND_SPEC): Replace -lasan with LIBASAN_SPEC. >> * doc/invoke.texi: Document -static-libasan. > > Jakub This patch adds STATIC_LIBASAN_LIBS so that user doesn't need to add -ldl -lpthread by hand. OK to install? Thanks. diff --git a/gcc/config/gnu-user.h b/gcc/config/gnu-user.h index cb45749..8c4bbc6 100644 --- a/gcc/config/gnu-user.h +++ b/gcc/config/gnu-user.h @@ -98,3 +98,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see #define TARGET_C99_FUNCTIONS 1 #define TARGET_HAS_SINCOS 1 + +/* Additional libraries needed by -static-libasan. */ +#undef STATIC_LIBASAN_LIBS +#define STATIC_LIBASAN_LIBS "-ldl -lpthread" diff --git a/gcc/gcc.c b/gcc/gcc.c index 7a275e1..ef8a485 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -546,8 +546,12 @@ proper position among the other output files. */ #ifndef LIBASAN_SPEC #ifdef HAVE_LD_STATIC_DYNAMIC +#ifndef STATIC_LIBASAN_LIBS +#define STATIC_LIBASAN_LIBS +#endif #define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \ - "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" + "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION \ + " " STATIC_LIBASAN_LIBS "}" #else #define LIBASAN_SPEC "-lasan" #endif