From patchwork Tue Nov 19 14:06:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 292446 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)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id C80282C00B9 for ; Wed, 20 Nov 2013 01:07:25 +1100 (EST) 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=u7HGj2deOODJQYDwFRJXuOqcNvAuiQ6XgewbsEtxPKHN/JaGDA+AQ hPZJdZzSJ/X7fdy/iTbLkT4jmauAY0OPR9LjkVaui3dX3prEYMf7I4oEt2S2UyWB amm38gtLGqJ7pCNJG4F0irxLA10IX8gkm3S7AeW+4YmHi3W0r8NXFQ= 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=G05+WW5Y1m0R00UPSUOuk3FsVLE=; b=X2PoRE6QLioTlhbqS0pR T7D8Z48j9p97hkpOlEI4MFfRnYkdjhUqrRzEJyqdV81BzxjABaG3bMY4IrtsvFcG gq1/jD4e85C65oD1EROTXNUVrXDzfONVtqUyg2s09LLoobTJcF1kCBZxgT2nufy4 yO42vg5Xvzn+9am3SSNHj+0= Received: (qmail 9741 invoked by alias); 19 Nov 2013 14:07:15 -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 9732 invoked by uid 89); 19 Nov 2013 14:07:15 -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_50, FREEMAIL_FROM, RDNS_NONE, SPF_PASS, URIBL_BLOCKED autolearn=no version=3.3.2 X-HELO: mail-pd0-f180.google.com Received: from Unknown (HELO mail-pd0-f180.google.com) (209.85.192.180) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Tue, 19 Nov 2013 14:07:14 +0000 Received: by mail-pd0-f180.google.com with SMTP id q10so2946010pdj.39 for ; Tue, 19 Nov 2013 06:07:06 -0800 (PST) X-Received: by 10.68.222.225 with SMTP id qp1mr2557626pbc.41.1384870026222; Tue, 19 Nov 2013 06:07:06 -0800 (PST) Received: from msticlxl57.ims.intel.com (fmdmzpr03-ext.fm.intel.com. [192.55.54.38]) by mx.google.com with ESMTPSA id hi5sm30773816pbb.43.2013.11.19.06.07.04 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Tue, 19 Nov 2013 06:07:05 -0800 (PST) Date: Tue, 19 Nov 2013 18:06:21 +0400 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, MPX, 2/X] Pointers Checker. Add flag to varpool_node Message-ID: <20131119140621.GS21297@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Hi, Here is a patch to add flag for marking symbols as requiring static initialization of bounds. Used by Pointer Bounds Checker to handle statically initialized pointers and static bounds vars. Thanks, Ilya --- 2013-11-19 Ilya Enkovich * cgraph.h (varpool_node): Add need_bounds_init field. * lto-cgraph.c (lto_output_varpool_node): Output need_bounds_init value. (input_varpool_node): Read need_bounds_init value. * varpool.c (dump_varpool_node): Dump need_bounds_init field. diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 1ac6dfb..31c3635 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -520,6 +520,10 @@ class GTY((tag ("SYMTAB_VARIABLE"))) varpool_node : public symtab_node { public: /* Set when variable is scheduled to be assembled. */ unsigned output : 1; + + /* Set when variable has statically initialized pointer + or is a static bounds variable and needs initalization. */ + unsigned need_bounds_init : 1; }; /* Every top level asm statement is put into a asm_node. */ diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 99dbf96..0d3479d 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -579,6 +579,7 @@ lto_output_varpool_node (struct lto_simple_output_block *ob, struct varpool_node && boundary_p && !DECL_EXTERNAL (node->decl), 1); /* in_other_partition. */ } + bp_pack_value (&bp, node->need_bounds_init, 1); streamer_write_bitpack (&bp); if (node->same_comdat_group && !boundary_p) { @@ -1149,6 +1150,7 @@ input_varpool_node (struct lto_file_decl_data *file_data, node->analyzed = bp_unpack_value (&bp, 1); node->used_from_other_partition = bp_unpack_value (&bp, 1); node->in_other_partition = bp_unpack_value (&bp, 1); + node->need_bounds_init = bp_unpack_value (&bp, 1); if (node->in_other_partition) { DECL_EXTERNAL (node->decl) = 1; diff --git a/gcc/varpool.c b/gcc/varpool.c index 1e4c823..471db82 100644 --- a/gcc/varpool.c +++ b/gcc/varpool.c @@ -204,6 +204,8 @@ dump_varpool_node (FILE *f, struct varpool_node *node) fprintf (f, " initialized"); if (node->output) fprintf (f, " output"); + if (node->need_bounds_init) + fprintf (f, " need-bounds-init"); if (TREE_READONLY (node->decl)) fprintf (f, " read-only"); if (ctor_for_folding (node->decl) != error_mark_node)