From patchwork Fri Apr 17 11:42:48 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 462029 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 813FF1402D5 for ; Fri, 17 Apr 2015 21:42:59 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=H1lc+oK7; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; q=dns; s=default; b=rqIVi78babYaWU+US/ eHkbYe7pRS0VIOdWhOUrWxjmbiDqb3rh4U+W0SKa2tDMdpT7pJd6HfITH2elpZJX eM5BmsgwIEOEX3R18Eekv4jUueo7EYZSI88qYUDmcc6gwv15MhwbQmK2UbKcLtOj x3XvRse/TeiegRGUbkWtOhWMM= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender :mime-version:in-reply-to:references:date:message-id:subject :from:to:cc:content-type; s=default; bh=FLl2fSlb2dcsBUTYL8B+F226 2/M=; b=H1lc+oK7xIn8ZR5Ig3cEltlBc/kRNyP10EbFntctibByY06gZnEVx29H 3aYop5znKGutKIBAdqMOv4DrdMd1wpI0+uT736cZYSpArlhOEN2CS/sno/r8RSF/ DBcrLIyZ+9Jmr6ve/F4X85pQHYz9Hj+R5ZdUa8PkKPuvzE96/MQ= Received: (qmail 44696 invoked by alias); 17 Apr 2015 11:42:51 -0000 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 Received: (qmail 44686 invoked by uid 89); 17 Apr 2015 11:42:50 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.0 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ob0-f176.google.com Received: from mail-ob0-f176.google.com (HELO mail-ob0-f176.google.com) (209.85.214.176) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Fri, 17 Apr 2015 11:42:50 +0000 Received: by obfe9 with SMTP id e9so67814512obf.1 for ; Fri, 17 Apr 2015 04:42:48 -0700 (PDT) MIME-Version: 1.0 X-Received: by 10.202.83.202 with SMTP id h193mr2435116oib.56.1429270968077; Fri, 17 Apr 2015 04:42:48 -0700 (PDT) Received: by 10.202.71.193 with HTTP; Fri, 17 Apr 2015 04:42:48 -0700 (PDT) In-Reply-To: <20150417112803.GB6178@msticlxl57.ims.intel.com> References: <20150417112803.GB6178@msticlxl57.ims.intel.com> Date: Fri, 17 Apr 2015 14:42:48 +0300 Message-ID: Subject: Fwd: [PATCH, CHKP] Don't require IPA_REF_CHKP reference for nodes other than instrumentation thunks From: Ilya Enkovich To: gcc-patches Cc: Jan Hubicka X-IsSubscribed: yes Hi, This patch is to resolve missing IPA_REF_CHKP issues. When node has instrumented version it usually has no body (either originally or was tranfromed into instrumentation thunk). But in some cases we don't instrument function and instrumentation clone becomes a thunk instead. In this case we still have IPA_REF_CHKP reference from the original node to its clone. But several passes (e.g. inline, expand) remove all node's references causing IPA_REF_CHKP check in verify_node fail. Initially I was going to always rebuild IPA_REF_CHKP for functions having instrumentation clones. But later realized this reference is used to keep instrumentation clones reachable which is not required when instrumentation clone has no body (and therefore will not be emitted anyway). Thus I just relaxed the check in verify_node. Bootstrapped and tested on x86_64-unknown-linux-gnu. Will apply to trunk and later to gcc_5 if no objections appear. Thanks, Ilya --- gcc/ 2015-04-16 Ilya Enkovich * cgraph.c (cgraph_node::verify_node): Require IPA_CHKP_REF for instrumentation thunks only. gcc/testsuite/ 2015-04-16 Ilya Enkovich * gcc.target/i386/mpx/chkp-reference-1.c: New. diff --git a/gcc/cgraph.c b/gcc/cgraph.c index 85531c8..cbf9cfc 100644 --- a/gcc/cgraph.c +++ b/gcc/cgraph.c @@ -3012,7 +3012,7 @@ cgraph_node::verify_node (void) ref_found = true; } - if (!ref_found) + if (!ref_found && thunk.thunk_p && thunk.add_pointer_bounds_args) { error ("Analyzed node has no reference to instrumented version"); error_found = true; diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-reference-1.c b/gcc/testsuite/gcc.target/i386/mpx/chkp-reference-1.c new file mode 100644 index 0000000..38b0ee2 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-reference-1.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fcheck-pointer-bounds -mmpx" } */ + +#include + +static int +test1 () +{ + jmp_buf buf; + int state; + + state = __builtin_setjmp (buf); + + return state; +} + +void test2 (int(*)()); + +void +test3 (void) +{ + test2 (test1); +}