From patchwork Wed Apr 8 13:47:59 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 459283 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 C1F541401AD for ; Wed, 8 Apr 2015 23:48:24 +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=piOcguhO; 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; q=dns; s=default; b=rBHohDMwS1+LwxsEe iV7qyIJB2tvZUa3rTUJQnnNt2AAnlvJC6w95RrEnBjwRjKV3/nlrUVnndrcF6oSz Gu1RXT90lffXKe7CdKEZvo2btLK66SHz6urFgx1JOlSqSwtWF5DSdtVZrfioLsdb uGnkGDAVHf4jqfuq2wUq7jEYwc= 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:date :from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=default; bh=rbdKcwE1QOUpCOo+JZyQWDH xuRM=; b=piOcguhOdFKPS4WdZsH7r3RaDKDKiTOb9bZgGKfjLnRkuWceMy8m8jk 2oULwbK8Pxvqs3DSkyn7ZHVuZvyhH6JVwxBK8LimmyDFDt5Or2CAmk+jgok/8tph zCFMf0Bil78Wl+FbupMQsEKfrKgFGAJM7Je1UkUo5EIUKL5MLbJw= Received: (qmail 7226 invoked by alias); 8 Apr 2015 13:48:14 -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 7212 invoked by uid 89); 8 Apr 2015 13:48:13 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ig0-f173.google.com Received: from mail-ig0-f173.google.com (HELO mail-ig0-f173.google.com) (209.85.213.173) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 08 Apr 2015 13:48:09 +0000 Received: by ignm3 with SMTP id m3so29500385ign.0 for ; Wed, 08 Apr 2015 06:48:07 -0700 (PDT) X-Received: by 10.50.97.41 with SMTP id dx9mr11843532igb.1.1428500887047; Wed, 08 Apr 2015 06:48:07 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr01-ext.fm.intel.com. [192.55.54.36]) by mx.google.com with ESMTPSA id lq3sm4077881igb.3.2015.04.08.06.48.05 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 08 Apr 2015 06:48:06 -0700 (PDT) Date: Wed, 8 Apr 2015 16:47:59 +0300 From: Ilya Enkovich To: Jan Hubicka Cc: gcc-patches@gcc.gnu.org Subject: Re: [PATCH] Walk through thunks when propagating comdat group Message-ID: <20150408134759.GE11622@msticlxl57.ims.intel.com> References: <20150407143501.GD11622@msticlxl57.ims.intel.com> <20150407203733.GB91010@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150407203733.GB91010@kam.mff.cuni.cz> User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes On 07 Apr 22:37, Jan Hubicka wrote: > > OK, thanks! > Please put the comment about inline clones just before the global.inlined_to test > and make the comment about thunks separate. > Probably "Thunks can not call across section boundary" > > Honza Here is a committed variant. Thanks, Ilya --- gcc/ 2015-04-08 Ilya Enkovich * ipa-comdats.c (propagate_comdat_group): Walk through thunks. gcc/testsuite/ 2015-04-08 Ilya Enkovich * gcc.target/i386/mpx/chkp-thunk-comdat-3.c: New. diff --git a/gcc/ipa-comdats.c b/gcc/ipa-comdats.c index f349f9f..4298b9b 100644 --- a/gcc/ipa-comdats.c +++ b/gcc/ipa-comdats.c @@ -142,12 +142,14 @@ propagate_comdat_group (struct symtab_node *symbol, { struct symtab_node *symbol2 = edge->caller; - /* If we see inline clone, its comdat group actually - corresponds to the comdat group of the function it is inlined - to. */ - if (cgraph_node * cn = dyn_cast (symbol2)) { + /* Thunks can not call across section boundary. */ + if (cn->thunk.thunk_p) + newgroup = propagate_comdat_group (symbol2, newgroup, map); + /* If we see inline clone, its comdat group actually + corresponds to the comdat group of the function it + is inlined to. */ if (cn->global.inlined_to) symbol2 = cn->global.inlined_to; } diff --git a/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c new file mode 100644 index 0000000..dd0057e --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/mpx/chkp-thunk-comdat-3.c @@ -0,0 +1,23 @@ +/* { dg-do compile } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O -fvisibility=hidden" } */ + +int val; + +static int __attribute__((noinline)) +test1 () +{ + return val; +} + +static int __attribute__((bnd_legacy,noinline)) +test2 () +{ + return test1 (); +} + +int +test3 (void) +{ + return test2 (); +} +