From: Alan Modra Date: Wed, 21 Sep 2022 05:15:06 +0000 (+0930) Subject: dwarf2.c remove varinfo and funcinfo sec field X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=6c0cf2ca0db6748edec00a2293541f95464268a0;p=binutils-gdb.git dwarf2.c remove varinfo and funcinfo sec field The "sec" field in these structures is only set and used in lookup functions. It always starts off as NULL. So the only possible effect of the field is to modify the return of the lookup, which was its purpose back in 2005 when HJ fixed PR990. Since then we solved the problem of relocatable object files with the fix for PR2338, so this field is now redundant. * dwarf.c (struct funcinfo, struct varinfo): Remove "sec" field. (lookup_symbol_in_function_table): Don't set or test "sec". (lookup_symbol_in_variable_table): Likewise. (info_hash_lookup_funcinfo, info_hash_lookup_varinfo): Likewise. --- diff --git a/bfd/dwarf2.c b/bfd/dwarf2.c index c55a3624367..e7c12c3e9de 100644 --- a/bfd/dwarf2.c +++ b/bfd/dwarf2.c @@ -1810,8 +1810,6 @@ struct funcinfo bool is_linkage; const char *name; struct arange arange; - /* Where the symbol is defined. */ - asection *sec; /* The offset of the funcinfo from the start of the unit. */ uint64_t unit_offset; }; @@ -1848,8 +1846,6 @@ struct varinfo const char *name; /* The address of the variable. */ bfd_vma addr; - /* Where the symbol is defined. */ - asection *sec; /* Is this a stack variable? */ bool stack; }; @@ -3354,7 +3350,6 @@ lookup_symbol_in_function_table (struct comp_unit *unit, bfd_vma best_fit_len = 0; struct arange *arange; const char *name = bfd_asymbol_name (sym); - asection *sec = bfd_asymbol_section (sym); for (each_func = unit->function_table; each_func; @@ -3364,8 +3359,7 @@ lookup_symbol_in_function_table (struct comp_unit *unit, arange; arange = arange->next) { - if ((!each_func->sec || each_func->sec == sec) - && addr >= arange->low + if (addr >= arange->low && addr < arange->high && each_func->name && strcmp (name, each_func->name) == 0 @@ -3380,7 +3374,6 @@ lookup_symbol_in_function_table (struct comp_unit *unit, if (best_fit) { - best_fit->sec = sec; *filename_ptr = best_fit->file; *linenumber_ptr = best_fit->line; return true; @@ -3402,7 +3395,6 @@ lookup_symbol_in_variable_table (struct comp_unit *unit, unsigned int *linenumber_ptr) { const char *name = bfd_asymbol_name (sym); - asection *sec = bfd_asymbol_section (sym); struct varinfo* each; for (each = unit->variable_table; each; each = each->prev_var) @@ -3410,13 +3402,11 @@ lookup_symbol_in_variable_table (struct comp_unit *unit, && each->file != NULL && each->name != NULL && each->addr == addr - && (!each->sec || each->sec == sec) && strcmp (name, each->name) == 0) break; if (each) { - each->sec = sec; *filename_ptr = each->file; *linenumber_ptr = each->line; return true; @@ -5079,7 +5069,6 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table, struct info_list_node *node; struct arange *arange; const char *name = bfd_asymbol_name (sym); - asection *sec = bfd_asymbol_section (sym); for (node = lookup_info_hash_table (hash_table, name); node; @@ -5090,8 +5079,7 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table, arange; arange = arange->next) { - if ((!each_func->sec || each_func->sec == sec) - && addr >= arange->low + if (addr >= arange->low && addr < arange->high && (!best_fit || arange->high - arange->low < best_fit_len)) @@ -5104,7 +5092,6 @@ info_hash_lookup_funcinfo (struct info_hash_table *hash_table, if (best_fit) { - best_fit->sec = sec; *filename_ptr = best_fit->file; *linenumber_ptr = best_fit->line; return true; @@ -5127,7 +5114,6 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table, unsigned int *linenumber_ptr) { const char *name = bfd_asymbol_name (sym); - asection *sec = bfd_asymbol_section (sym); struct varinfo* each; struct info_list_node *node; @@ -5136,10 +5122,8 @@ info_hash_lookup_varinfo (struct info_hash_table *hash_table, node = node->next) { each = (struct varinfo *) node->info; - if (each->addr == addr - && (!each->sec || each->sec == sec)) + if (each->addr == addr) { - each->sec = sec; *filename_ptr = each->file; *linenumber_ptr = each->line; return true;