aboutsummaryrefslogtreecommitdiff
path: root/gcc/cgraphunit.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/cgraphunit.c')
-rw-r--r--gcc/cgraphunit.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/gcc/cgraphunit.c b/gcc/cgraphunit.c
index 6f61f5c..d2e8847 100644
--- a/gcc/cgraphunit.c
+++ b/gcc/cgraphunit.c
@@ -223,6 +223,7 @@ along with GCC; see the file COPYING3. If not see
#include "tree-nested.h"
#include "gimplify.h"
#include "dbgcnt.h"
+#include "tree-chkp.h"
/* Queue of cgraph nodes scheduled to be added into cgraph. This is a
secondary queue used during optimization to accommodate passes that
@@ -802,6 +803,9 @@ varpool_node::finalize_decl (tree decl)
|| (!flag_toplevel_reorder
&& symtab->state == EXPANSION))
node->assemble_decl ();
+
+ if (DECL_INITIAL (decl))
+ chkp_register_var_initializer (decl);
}
/* EDGE is an polymorphic call. Mark all possible targets as reachable
@@ -875,6 +879,11 @@ walk_polymorphic_call_targets (hash_set<void *> *reachable_call_targets,
edge->make_direct (target);
edge->redirect_call_stmt_to_callee ();
+
+ /* Call to __builtin_unreachable shouldn't be instrumented. */
+ if (!targets.length ())
+ gimple_call_set_with_bounds (edge->call_stmt, false);
+
if (symtab->dump_file)
{
fprintf (symtab->dump_file,
@@ -1584,6 +1593,7 @@ cgraph_node::expand_thunk (bool output_asm_thunks, bool force_gimple_thunk)
call = gimple_build_call_vec (build_fold_addr_expr_loc (0, alias), vargs);
callees->call_stmt = call;
gimple_call_set_from_thunk (call, true);
+ gimple_call_set_with_bounds (call, instrumentation_clone);
if (restmp)
{
gimple_call_set_lhs (call, restmp);
@@ -1680,7 +1690,8 @@ cgraph_node::assemble_thunks_and_aliases (void)
ipa_ref *ref;
for (e = callers; e;)
- if (e->caller->thunk.thunk_p)
+ if (e->caller->thunk.thunk_p
+ && !e->caller->thunk.add_pointer_bounds_args)
{
cgraph_node *thunk = e->caller;
@@ -2087,9 +2098,13 @@ void
symbol_table::output_weakrefs (void)
{
symtab_node *node;
+ cgraph_node *cnode;
FOR_EACH_SYMBOL (node)
if (node->alias
&& !TREE_ASM_WRITTEN (node->decl)
+ && (!(cnode = dyn_cast <cgraph_node *> (node))
+ || !cnode->instrumented_version
+ || !TREE_ASM_WRITTEN (cnode->instrumented_version->decl))
&& node->weakref)
{
tree target;