From: Alan Modra <amodra@gmail.com>
To: binutils@sourceware.org
Subject: [PATCH 1/2] Reduce duplicated symbol_clone_if_forward_ref work
Date: Wed, 9 Mar 2022 15:55:05 +1030 [thread overview]
Message-ID: <20220309052506.4000271-2-amodra@gmail.com> (raw)
In-Reply-To: <20220309052506.4000271-1-amodra@gmail.com>
* symbol.c (struct symbol_flags): Add forward_resolved.
(symbol_entry_find): Update needle initialisation.
(symbol_clone_if_forward_ref): Do no work when forward_resolved
is already set. Set forward_resolved.
diff --git a/gas/symbols.c b/gas/symbols.c
index 2a0ee7783c0..b35c6d25aca 100644
--- a/gas/symbols.c
+++ b/gas/symbols.c
@@ -61,8 +61,10 @@ struct symbol_flags
/* Whether the symbol can be re-defined. */
unsigned int volatil : 1;
- /* Whether the symbol is a forward reference. */
+ /* Whether the symbol is a forward reference, and whether such has
+ been determined. */
unsigned int forward_ref : 1;
+ unsigned int forward_resolved : 1;
/* This is set if the symbol is defined in an MRI common section.
We handle such sections as single common symbols, so symbols
@@ -202,7 +204,7 @@ static void *
symbol_entry_find (htab_t table, const char *name)
{
hashval_t hash = htab_hash_string (name);
- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
hash, name, 0, 0, 0 } };
return htab_find_with_hash (table, &needle, hash);
}
@@ -777,7 +779,9 @@ symbol_clone (symbolS *orgsymP, int replace)
symbolS *
symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
{
- if (symbolP && !symbolP->flags.local_symbol)
+ if (symbolP
+ && !symbolP->flags.local_symbol
+ && !symbolP->flags.forward_resolved)
{
symbolS *orig_add_symbol = symbolP->x->value.X_add_symbol;
symbolS *orig_op_symbol = symbolP->x->value.X_op_symbol;
@@ -830,6 +834,7 @@ symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
symbolP->x->value.X_add_symbol = add_symbol;
symbolP->x->value.X_op_symbol = op_symbol;
+ symbolP->flags.forward_resolved = 1;
}
return symbolP;
next prev parent reply other threads:[~2022-03-09 5:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-09 5:25 [PATCH 0/2] rh2059646 - compilation of prusa-slicer hangs Alan Modra
2022-03-09 5:25 ` Alan Modra [this message]
2022-03-09 5:25 ` [PATCH 2/2] Constant fold view increment expressions Alan Modra
2022-03-09 9:23 ` Fix for bug 28924 Viorel Preoteasa
2022-03-09 11:42 ` Nick Clifton
2022-03-16 19:10 ` Viorel Preoteasa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220309052506.4000271-2-amodra@gmail.com \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).