From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id EED513858282 for ; Wed, 21 Sep 2022 06:16:19 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EED513858282 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-pg1-x52d.google.com with SMTP id h188so4906771pgc.12 for ; Tue, 20 Sep 2022 23:16:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :from:to:cc:subject:date; bh=CPWn/oUYUveJYC9i3vAlRN3O5WEgSF8upQirRS7lbd0=; b=pWXg/YUCuWI9WFy0ugXfdm00ET04cDjRk+gqM6myuVQNhE0sym8lK0vju36hgBmgtk 9xIXrnyvfSyQKApKOCZA61n6S167NeFjQbfDZOCl22AYuNNyf4qyZ2fYjKqwbEYeyBTx VNEJtZXtO+qkV3l5vzn/EkBZsfT7e1S9cnlAqj7PJiCeGRnU1OGxWSQ2mw/W2KNoRzWK PweIy5Y1bkmxWILu0KYwxWmkQrFAOl9/h+Wkn3mNF9Jke+9tOrLt7ePSLNbMzULlSNbr RWXMAy4SsN1JhWTtlsodJrkHHxMKAYKWCTG8ycs5u8FydAiMThFNl/NhmR7EpFx7UmGg UAhg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=CPWn/oUYUveJYC9i3vAlRN3O5WEgSF8upQirRS7lbd0=; b=LryfUCNcnKFnvWUm6OfiO/cD8x1gPuZ6vniWE7/7Q6cgIcsWUZQtbLO19cBGWBOH+p 8CkMARTgQt17/S2uYVI+8+2NLtfd9RLbUZeWEG8bVOS42vk8L2RV4QOAnGaE6LLuoGPw Xubkd39kfrkX2sKDWM2JAo4OWeeP9eTpM+BZvw9zww8aYp7WnUMIH3dEh4vVd12WrKxi eLQGDHwdFW8Y9O8ltQJRlwNPOe26UPR+pjd8Mh2c0RHwlGG09IrDtAYQXaMTyoOaxQiO AMWWlowDU/0ouA2fads0M1o1sJQ153zObYbRYD56xT1FA2Yrl7OZWn3bcs4Zg3BuXEGV GHaw== X-Gm-Message-State: ACrzQf1WdpDC/rtBaiaFAlIusNX9DV0miRbiGa5IAq/DXJf5Cc+bFXMP 2lbGKvEaQr6ur9fd3H42EggwDm2JCso= X-Google-Smtp-Source: AMsMyM6bmP58OB9/wFeCzhefrpNMIJMCKa04b0cgp5VyKfPThXQF5r31oiCVNYzhc2yDs0Vd5x6BhA== X-Received: by 2002:a63:4714:0:b0:42b:82d9:b617 with SMTP id u20-20020a634714000000b0042b82d9b617mr22660965pga.223.1663740978595; Tue, 20 Sep 2022 23:16:18 -0700 (PDT) Received: from squeak.grove.modra.org (158.106.96.58.static.exetel.com.au. [58.96.106.158]) by smtp.gmail.com with ESMTPSA id v67-20020a622f46000000b0054ee4b632dasm1078609pfv.169.2022.09.20.23.16.17 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 20 Sep 2022 23:16:18 -0700 (PDT) Received: by squeak.grove.modra.org (Postfix, from userid 1000) id 67C5C1140AB9; Wed, 21 Sep 2022 15:46:15 +0930 (ACST) Date: Wed, 21 Sep 2022 15:46:15 +0930 From: Alan Modra To: binutils@sourceware.org Subject: dwarf2.c remove varinfo and funcinfo sec field Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline X-Spam-Status: No, score=-3036.5 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: 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; -- Alan Modra Australia Development Lab, IBM