From b917f6bf4192a0e910de6752ad0e95fbba309e2f Mon Sep 17 00:00:00 2001 From: Giuliano Belinassi Date: Wed, 15 Jul 2020 23:31:34 -0300 Subject: Get bootstrap to work with symbol promotion. Previously, bootstrap was failing when compiling `genattrtab.c' because a required varnode was being mistakenly removed of the symbol table. This commit addresses this. gcc/ChangeLog 2020-07-14 Giuliano Belinassi * symtab.c (find_by_order): New function. (find_by_name): New function. (find_by_asm_naem): New function. * lto-cgraph.c (handle_node_in_boundary): Promote varnode in boundary to be external. --- gcc/ChangeLog | 8 ++++++++ gcc/cgraph.h | 9 +++++++++ gcc/lto-cgraph.c | 5 ++++- gcc/symtab.c | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 55 insertions(+), 1 deletion(-) (limited to 'gcc') diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 55474f0..9019521 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,5 +1,13 @@ 2020-07-14 Giuliano Belinassi + * symtab.c (find_by_order): New function. + (find_by_name): New function. + (find_by_asm_naem): New function. + * lto-cgraph.c (handle_node_in_boundary): Promote varnode in boundary + to be external. + +2020-07-14 Giuliano Belinassi + * cgraphunit.c (ipa_passes): Move split_outputs to. (symbol_table::compile): Here. Also make sure it runs after the IPA transformation stage. diff --git a/gcc/cgraph.h b/gcc/cgraph.h index 962670c..a7779c1 100644 --- a/gcc/cgraph.h +++ b/gcc/cgraph.h @@ -463,6 +463,15 @@ public: Return NULL if there's no such node. */ static symtab_node *get_for_asmname (const_tree asmname); + /* Get symtab node by order. */ + static symtab_node *find_by_order (int order); + + /* Get symtab_node by its name. */ + static symtab_node *find_by_name (const char *); + + /* Get symtab_node by its ASM name. */ + static symtab_node *find_by_asm_name (const char *); + /* Verify symbol table for internal consistency. */ static DEBUG_FUNCTION void verify_symtab_nodes (void); diff --git a/gcc/lto-cgraph.c b/gcc/lto-cgraph.c index 1971fdb..c57d16a 100644 --- a/gcc/lto-cgraph.c +++ b/gcc/lto-cgraph.c @@ -2126,7 +2126,10 @@ handle_node_in_boundary (symtab_node *node, bool keep_body) } } else if (is_a (node) && !DECL_EXTERNAL (node->decl)) - node->in_other_partition = true; + { + DECL_EXTERNAL (node->decl) = true; + node->in_other_partition = true; + } } /* Check the boundary and expands it if necessary, including more nodes or diff --git a/gcc/symtab.c b/gcc/symtab.c index a5fba15..f56dd69 100644 --- a/gcc/symtab.c +++ b/gcc/symtab.c @@ -2493,3 +2493,37 @@ symtab_node::output_to_lto_symbol_table_p (void) } return true; } + +DEBUG_FUNCTION symtab_node * +symtab_node::find_by_order (int order) +{ + symtab_node *node; + FOR_EACH_SYMBOL (node) + if (node->order == order) + return node; + + return NULL; +} + +DEBUG_FUNCTION symtab_node * +symtab_node::find_by_name (const char * name) +{ + symtab_node *node; + FOR_EACH_SYMBOL (node) + if (!strcmp (node->name (), name)) + return node; + + return NULL; +} + +DEBUG_FUNCTION symtab_node * +symtab_node::find_by_asm_name (const char *asm_name) +{ + symtab_node *node; + FOR_EACH_SYMBOL (node) + if (!strcmp (node->asm_name (), asm_name)) + return node; + + return NULL; + +} -- cgit v1.1