From patchwork Mon Nov 19 05:01:17 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: 199923 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 DEACE2C007E for ; Mon, 19 Nov 2012 16:01:32 +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=1353906093; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Received:Date:From:To:Subject:Message-ID:MIME-Version: Content-Type:Content-Disposition:User-Agent:Mailing-List: Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:Sender:Delivered-To; bh=fZQCWphVlYcnAsve0DXgR6LXgVM=; b=btHoVxGcqgXuHtCP61uFcVmAB6qUnWRQ+1xhHwxBgxoQdImTOwV2gJ65J5Sn5a ZxJHcQ9D1RQWGBeEoHpjlwXz8pVsd1QKCMyowEvvWofiVclg3vX40Ssm8jMVJuVY 7/IPM+4FiHFAZ2m3xSzv7AZMF6nPjP96LP4NRx0w4xqTs= 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:Received:Received:Received:Date:From:To:Subject:Message-ID:MIME-Version:Content-Type:Content-Disposition:User-Agent:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=p4h4qLBrv7QHppC1Gb80z75kWNdNsXFqk7ShPgBOd7A9NNO/dewkKsnd8+552m bkeKPTaN1dNiS+utG8L7neLmsL4OCVhe7fwoI3VITguMH2Lt1NdYIvc3+m9Kqa72 hdm2rLV9feNAC6cfkqQFDlSTOuQQ1Qn8NRLM/2w4UZK8A=; Received: (qmail 12639 invoked by alias); 19 Nov 2012 05:01:27 -0000 Received: (qmail 12631 invoked by uid 22791); 19 Nov 2012 05:01:26 -0000 X-SWARE-Spam-Status: No, hits=-4.2 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, KHOP_RCVD_TRUST, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-ia0-f175.google.com (HELO mail-ia0-f175.google.com) (209.85.210.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 19 Nov 2012 05:01:20 +0000 Received: by mail-ia0-f175.google.com with SMTP id z3so3231688iad.20 for ; Sun, 18 Nov 2012 21:01:19 -0800 (PST) Received: by 10.50.106.136 with SMTP id gu8mr5643421igb.42.1353301279655; Sun, 18 Nov 2012 21:01:19 -0800 (PST) Received: from gnu-tools-1.localdomain (76-220-57-190.lightspeed.sntcca.sbcglobal.net. [76.220.57.190]) by mx.google.com with ESMTPS id px5sm6460442igc.0.2012.11.18.21.01.18 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 18 Nov 2012 21:01:19 -0800 (PST) Received: by gnu-tools-1.localdomain (Postfix, from userid 1000) id 8A8431AB2E4; Sun, 18 Nov 2012 21:01:17 -0800 (PST) Date: Sun, 18 Nov 2012 21:01:17 -0800 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Subject: [PATCH] Add STATIC_LIBASAN_LIBS for -static-libasan Message-ID: <20121119050117.GA31538@gmail.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, This patch adds STATIC_LIBASAN_LIBS so that one can simply use "gcc -faddress-sanitizer -static-libasan". OK to install? Thanks. H.J. --- 2012-11-18 H.J. Lu * gcc.c (ADD_STATIC_LIBASAN_LIBS): New macro. Defined with STATIC_LIBASAN_LIBS. (LIBASAN_SPEC): Add STATIC_LIBASAN_LIBS. * config/gnu-user.h (STATIC_LIBASAN_LIBS): New macro. 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 11279be4..5e68d71 100644 --- a/gcc/gcc.c +++ b/gcc/gcc.c @@ -545,11 +545,18 @@ proper position among the other output files. */ #define STACK_SPLIT_SPEC " %{fsplit-stack: --wrap=pthread_create}" #ifndef LIBASAN_SPEC +#ifdef STATIC_LIBASAN_LIBS +#define ADD_STATIC_LIBASAN_LIBS \ + " %{static-libasan:" STATIC_LIBASAN_LIBS "}" +#else +#define ADD_STATIC_LIBASAN_LIBS +#endif #ifdef HAVE_LD_STATIC_DYNAMIC #define LIBASAN_SPEC "%{static-libasan:" LD_STATIC_OPTION \ - "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" + "} -lasan %{static-libasan:" LD_DYNAMIC_OPTION "}" \ + ADD_STATIC_LIBASAN_LIBS #else -#define LIBASAN_SPEC "-lasan" +#define LIBASAN_SPEC "-lasan" ADD_STATIC_LIBASAN_LIBS #endif #endif