This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- From: Ilya Enkovich <enkovich dot gnu at gmail dot com>
- To: gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Mon, 18 Nov 2013 13:21:46 +0400
- Subject: Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Authentication-results: sourceware.org; auth=none
- References: <CAMbmDYa265-Jbk2Uq3-7uKu+mAHrHagQ4iRRRnt7ip6ejhx6eg at mail dot gmail dot com> <CAFiYyc0-TcYs0MjpmyR0Cho+3OG1WdX9xDNnm9KuXioQ1jk2=w at mail dot gmail dot com> <CAMbmDYaOzYjcud8L3fvsj94mWpvNrFTQGHR=p5akvFPrD-NYDA at mail dot gmail dot com> <CAFiYyc2xd7wynB9JRPF3KWY6EhXg-=KUg=g5BTxOjzO1pF3ovQ at mail dot gmail dot com> <CAMbmDYZSpcnCxufY59_QCL_Zp8-=+fQEZvi_tJCDKE=M=Hwqfg at mail dot gmail dot com> <CAFiYyc0RGepPUTU36HCvLrFFM_Y1eGae9kuAV8tn=MZnTRLwzA at mail dot gmail dot com> <CAMbmDYaL=q4D5qfXENhaH5OjdsMznwiyWURWLDw+8unyxP-0oQ at mail dot gmail dot com> <CAFiYyc2owq4pow_h0uep6vw9wUoay5CrLVEVpAuq0yQSmgiW7w at mail dot gmail dot com> <CAMbmDYbm5=Z-MpeSWuu9+K=fUfcPUjzNfHWWVGVAGNW=UB=O9Q at mail dot gmail dot com> <CAFiYyc1wzbuW11n5LE5LHi7Zhxkt3wgT_0LHW=UGJ3zAqvpETg at mail dot gmail dot com> <20131108090256 dot GA21297 at msticlxl57 dot ims dot intel dot com>
Ping
2013/11/8 Ilya Enkovich <enkovich.gnu@gmail.com>:
> Hi,
>
> Here is an updated patch version with no langhook.
>
> Regarding TLS objects issue - I do not think compiler should compensate the absence of instrumentation in libraries. Compiler should be responsible for initialization of Bounds Tables for .tdata section. Correct data copy is a responsibility of library. User should use either instrumented library or wrapper calls if he needs this functionality.
>
> Thanks,
> Ilya
> --
> gcc/
>
> 2013-11-06 Ilya Enkovich <ilya.enkovich@intel.com>
>
> * c/c-parser.c: Include tree-chkp.h.
> (c_parser_declaration_or_fndef): Register statically
> initialized decls in Pointer Bounds Checker.
> * cp/decl.c: Include tree-chkp.h.
> (cp_finish_decl): Register statically
> initialized decls in Pointer Bounds Checker.
> * gimplify.c: Include tree-chkp.h.
> (gimplify_init_constructor): Register statically
> initialized decls in Pointer Bounds Checker.
>
>
> diff --git a/gcc/c/c-parser.c b/gcc/c/c-parser.c
> index 9ccae3b..397b323 100644
> --- a/gcc/c/c-parser.c
> +++ b/gcc/c/c-parser.c
> @@ -56,6 +56,7 @@ along with GCC; see the file COPYING3. If not see
> #include "cgraph.h"
> #include "plugin.h"
> #include "omp-low.h"
> +#include "tree-chkp.h"
>
>
> /* Initialization routine for this file. */
> @@ -1682,6 +1683,12 @@ c_parser_declaration_or_fndef (c_parser *parser, bool fndef_ok,
> maybe_warn_string_init (TREE_TYPE (d), init);
> finish_decl (d, init_loc, init.value,
> init.original_type, asm_name);
> +
> + /* Register all decls with initializers in Pointer
> + Bounds Checker to generate required static bounds
> + initializers. */
> + if (DECL_INITIAL (d) != error_mark_node)
> + chkp_register_var_initializer (d);
> }
> }
> else
> diff --git a/gcc/cp/decl.c b/gcc/cp/decl.c
> index 1e92f2a..74df02f 100644
> --- a/gcc/cp/decl.c
> +++ b/gcc/cp/decl.c
> @@ -53,6 +53,7 @@ along with GCC; see the file COPYING3. If not see
> #include "splay-tree.h"
> #include "plugin.h"
> #include "cgraph.h"
> +#include "tree-chkp.h"
>
> /* Possible cases of bad specifiers type used by bad_specifiers. */
> enum bad_spec_place {
> @@ -6379,6 +6380,12 @@ cp_finish_decl (tree decl, tree init, bool init_const_expr_p,
> the class specifier. */
> if (!DECL_EXTERNAL (decl))
> var_definition_p = true;
> +
> + /* If var has initilizer then we need to register it in
> + Pointer Bounds Checker to generate static bounds initilizer
> + if required. */
> + if (DECL_INITIAL (decl) && DECL_INITIAL (decl) != error_mark_node)
> + chkp_register_var_initializer (decl);
> }
> /* If the variable has an array type, lay out the type, even if
> there is no initializer. It is valid to index through the
> diff --git a/gcc/gimplify.c b/gcc/gimplify.c
> index 4f52c27..7aaac15 100644
> --- a/gcc/gimplify.c
> +++ b/gcc/gimplify.c
> @@ -48,6 +48,7 @@ along with GCC; see the file COPYING3. If not see
> #include "vec.h"
> #include "omp-low.h"
> #include "gimple-low.h"
> +#include "tree-chkp.h"
>
> #include "langhooks-def.h" /* FIXME: for lhd_set_decl_assembler_name */
> #include "tree-pass.h" /* FIXME: only for PROP_gimple_any */
> @@ -4111,6 +4112,11 @@ gimplify_init_constructor (tree *expr_p, gimple_seq *pre_p, gimple_seq *post_p,
>
> walk_tree (&ctor, force_labels_r, NULL, NULL);
> ctor = tree_output_constant_def (ctor);
> +
> + /* We need to register created constant object to
> + initialize bounds for pointers in it. */
> + chkp_register_var_initializer (ctor);
> +
> if (!useless_type_conversion_p (type, TREE_TYPE (ctor)))
> ctor = build1 (VIEW_CONVERT_EXPR, type, ctor);
> TREE_OPERAND (*expr_p, 1) = ctor;
- References:
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support
- Re: [PATCH, MPX, 2/X] Pointers Checker [8/25] Languages support