From patchwork Fri Jan 30 22:18:36 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 435058 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 F27D71401F0 for ; Sat, 31 Jan 2015 09:41:28 +1100 (AEDT) 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:subject:message-id:mime-version:content-type; q=dns; s= default; b=pzSrI55fH80EoJHui4kve716Z4CUfPP1RBe9jZswDjOQrmt4CIcw8 iwsGs5S4uejTnKXS3xNStIlVFapMoXQ8u2D2L9uaJ4+OeO2lFUFGJbJcQEDKcTuq kQ4z5wYi+/XTNowM2cOxUZmoKb0H2UP5YMQTY9ClMfZyuzfjH4VC9Y= 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:subject:message-id:mime-version:content-type; s= default; bh=ZIrEbnyCP3utn9ldRZAaOSGhr2U=; b=LUG7EkL6pPFMMO/xKuZx 2BeJHoFX2zaTYMIg3AwFh5NxpQARUPCeBwFn5rmiT2YWnDXKwN/zW1fhO6oXXoYO L9GFVArKyetnq6hwVoKb3gqmceE0rTbrvs0MZTk3Keh0+X/vl0PM98e68JvO3GLW d0F9N2aSorNgxwlbO6RBJvo= Received: (qmail 16101 invoked by alias); 30 Jan 2015 22:18:57 -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 16063 invoked by uid 89); 30 Jan 2015 22:18:56 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.2 required=5.0 tests=AWL, BAYES_00, FREEMAIL_FROM, KAM_STOCKGEN, RCVD_IN_DNSWL_LOW, SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ie0-f174.google.com Received: from mail-ie0-f174.google.com (HELO mail-ie0-f174.google.com) (209.85.223.174) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 30 Jan 2015 22:18:55 +0000 Received: by mail-ie0-f174.google.com with SMTP id vy18so6593307iec.5 for ; Fri, 30 Jan 2015 14:18:52 -0800 (PST) X-Received: by 10.50.43.198 with SMTP id y6mr1339365igl.16.1422656332686; Fri, 30 Jan 2015 14:18:52 -0800 (PST) Received: from msticlxl57.ims.intel.com ([192.55.54.42]) by mx.google.com with ESMTPSA id g15sm1817461ioi.22.2015.01.30.14.18.51 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 30 Jan 2015 14:18:52 -0800 (PST) Date: Sat, 31 Jan 2015 01:18:36 +0300 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, CHKP] Follow alias chain for decl visibility and aliases Message-ID: <20150130221836.GA10572@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, This patch fixes two more cases where alias chain should be followed to emit correct assembler name for instrumented functions. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk? Thanks, Ilya --- gcc/ 2015-01-30 Ilya Enkovich * varasm.c (do_assemble_alias): Follow transparent alias chain for target. (default_assemble_visibility): Follow transparent alias chain for decl name. gcc/testsuite/ 2015-01-30 Ilya Enkovich * gcc.target/i386/chkp-hidden-def.c: New. diff --git a/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c b/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c new file mode 100644 index 0000000..8d2b228 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/chkp-hidden-def.c @@ -0,0 +1,15 @@ +/* { dg-do compile } */ +/* { dg-require-effective-target mpx } */ +/* { dg-options "-fcheck-pointer-bounds -mmpx -O2" } */ +/* { dg-final { scan-assembler-not "test.chkp" } } */ + +int test (int *p); +extern __typeof (test) test __asm__ ("" "__test") __attribute__ ((visibility ("hidden"))); + +int test (int *p) +{ + return *p; +} + +extern __typeof (test) __test1 __asm__("" "test"); +extern __typeof (test) __test1 __attribute__((alias ("" "__test"))); diff --git a/gcc/varasm.c b/gcc/varasm.c index 2069432..eb65b1f 100644 --- a/gcc/varasm.c +++ b/gcc/varasm.c @@ -5601,6 +5601,7 @@ do_assemble_alias (tree decl, tree target) id = DECL_ASSEMBLER_NAME (decl); ultimate_transparent_alias_target (&id); + ultimate_transparent_alias_target (&target); /* We must force creation of DECL_RTL for debug info generation, even though we don't use it here. */ @@ -5612,8 +5613,6 @@ do_assemble_alias (tree decl, tree target) if (lookup_attribute ("weakref", DECL_ATTRIBUTES (decl))) { - ultimate_transparent_alias_target (&target); - if (!TREE_SYMBOL_REFERENCED (target)) weakref_targets = tree_cons (decl, target, weakref_targets); @@ -5944,8 +5943,12 @@ default_assemble_visibility (tree decl ATTRIBUTE_UNUSED, }; const char *name, *type; + tree id; + + id = DECL_ASSEMBLER_NAME (decl); + ultimate_transparent_alias_target (&id); + name = IDENTIFIER_POINTER (id); - name = IDENTIFIER_POINTER (DECL_ASSEMBLER_NAME (decl)); type = visibility_types[vis]; fprintf (asm_out_file, "\t.%s\t", type);