|
|
12f9d8 |
diff -rup binutils.orig/gas/symbols.c binutils-2.38/gas/symbols.c
|
|
|
12f9d8 |
--- binutils.orig/gas/symbols.c 2022-03-09 11:43:34.706610216 +0000
|
|
|
12f9d8 |
+++ binutils-2.38/gas/symbols.c 2022-03-09 11:45:57.540686508 +0000
|
|
|
12f9d8 |
@@ -61,8 +61,10 @@ struct symbol_flags
|
|
|
12f9d8 |
/* Whether the symbol can be re-defined. */
|
|
|
12f9d8 |
unsigned int volatil : 1;
|
|
|
12f9d8 |
|
|
|
12f9d8 |
- /* Whether the symbol is a forward reference. */
|
|
|
12f9d8 |
+ /* Whether the symbol is a forward reference, and whether such has
|
|
|
12f9d8 |
+ been determined. */
|
|
|
12f9d8 |
unsigned int forward_ref : 1;
|
|
|
12f9d8 |
+ unsigned int forward_resolved : 1;
|
|
|
12f9d8 |
|
|
|
12f9d8 |
/* This is set if the symbol is defined in an MRI common section.
|
|
|
12f9d8 |
We handle such sections as single common symbols, so symbols
|
|
|
12f9d8 |
@@ -202,7 +204,7 @@ static void *
|
|
|
12f9d8 |
symbol_entry_find (htab_t table, const char *name)
|
|
|
12f9d8 |
{
|
|
|
12f9d8 |
hashval_t hash = htab_hash_string (name);
|
|
|
12f9d8 |
- symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
12f9d8 |
+ symbol_entry_t needle = { { { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
|
|
|
12f9d8 |
hash, name, 0, 0, 0 } };
|
|
|
12f9d8 |
return htab_find_with_hash (table, &needle, hash);
|
|
|
12f9d8 |
}
|
|
|
12f9d8 |
@@ -784,7 +786,9 @@ symbol_clone (symbolS *orgsymP, int repl
|
|
|
12f9d8 |
symbolS *
|
|
|
12f9d8 |
symbol_clone_if_forward_ref (symbolS *symbolP, int is_forward)
|
|
|
12f9d8 |
{
|
|
|
12f9d8 |
- if (symbolP && !symbolP->flags.local_symbol)
|
|
|
12f9d8 |
+ if (symbolP
|
|
|
12f9d8 |
+ && !symbolP->flags.local_symbol
|
|
|
12f9d8 |
+ && !symbolP->flags.forward_resolved)
|
|
|
12f9d8 |
{
|
|
|
12f9d8 |
symbolS *orig_add_symbol = symbolP->x->value.X_add_symbol;
|
|
|
12f9d8 |
symbolS *orig_op_symbol = symbolP->x->value.X_op_symbol;
|
|
|
12f9d8 |
@@ -837,6 +841,7 @@ symbol_clone_if_forward_ref (symbolS *sy
|
|
|
12f9d8 |
|
|
|
12f9d8 |
symbolP->x->value.X_add_symbol = add_symbol;
|
|
|
12f9d8 |
symbolP->x->value.X_op_symbol = op_symbol;
|
|
|
12f9d8 |
+ symbolP->flags.forward_resolved = 1;
|
|
|
12f9d8 |
}
|
|
|
12f9d8 |
|
|
|
12f9d8 |
return symbolP;
|
|
|
12f9d8 |
diff -rup binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d
|
|
|
12f9d8 |
--- binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:43:34.487611632 +0000
|
|
|
12f9d8 |
+++ binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:48:03.298873228 +0000
|
|
|
12f9d8 |
@@ -2,9 +2,8 @@
|
|
|
12f9d8 |
#readelf: -x.rodata -wL
|
|
|
12f9d8 |
#name: DWARF2 18
|
|
|
12f9d8 |
# The am33 cr16 crx ft32 mn10 msp430 nds32 and rl78 targets do not evaluate the subtraction of symbols at assembly time.
|
|
|
12f9d8 |
-# The mep targets turns some view computations into complex relocations.
|
|
|
12f9d8 |
# The riscv targets do not support the subtraction of symbols.
|
|
|
12f9d8 |
-#xfail: am3*-* cr16-* crx-* ft32*-* mep-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
|
|
|
12f9d8 |
+#xfail: am3*-* cr16-* crx-* ft32*-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
|
|
|
12f9d8 |
|
|
|
12f9d8 |
Hex dump of section '\.rodata':
|
|
|
12f9d8 |
0x00000000 0100 *.*
|
|
|
12f9d8 |
--- binutils.orig/gas/dwarf2dbg.c 2022-03-10 09:13:18.516639363 +0000
|
|
|
12f9d8 |
+++ binutils-2.38/gas/dwarf2dbg.c 2022-03-10 12:45:25.191933733 +0000
|
|
|
12f9d8 |
@@ -402,18 +402,27 @@ set_or_check_view (struct line_entry *e,
|
|
|
12f9d8 |
if (viewx.X_op != O_constant || viewx.X_add_number)
|
|
|
12f9d8 |
{
|
|
|
12f9d8 |
expressionS incv;
|
|
|
12f9d8 |
+ expressionS *p_view;
|
|
|
12f9d8 |
|
|
|
12f9d8 |
if (!p->loc.u.view)
|
|
|
12f9d8 |
- {
|
|
|
12f9d8 |
- p->loc.u.view = symbol_temp_make ();
|
|
|
12f9d8 |
- gas_assert (!S_IS_DEFINED (p->loc.u.view));
|
|
|
12f9d8 |
- }
|
|
|
12f9d8 |
+ p->loc.u.view = symbol_temp_make ();
|
|
|
12f9d8 |
|
|
|
12f9d8 |
memset (&incv, 0, sizeof (incv));
|
|
|
12f9d8 |
incv.X_unsigned = 1;
|
|
|
12f9d8 |
incv.X_op = O_symbol;
|
|
|
12f9d8 |
incv.X_add_symbol = p->loc.u.view;
|
|
|
12f9d8 |
incv.X_add_number = 1;
|
|
|
12f9d8 |
+ p_view = symbol_get_value_expression (p->loc.u.view);
|
|
|
12f9d8 |
+ if (p_view->X_op == O_constant || p_view->X_op == O_symbol)
|
|
|
12f9d8 |
+ {
|
|
|
12f9d8 |
+ /* If we can, constant fold increments so that a chain of
|
|
|
12f9d8 |
+ expressions v + 1 + 1 ... + 1 is not created.
|
|
|
12f9d8 |
+ resolve_expression isn't ideal for this purpose. The
|
|
|
12f9d8 |
+ base v might not be resolvable until later. */
|
|
|
12f9d8 |
+ incv.X_op = p_view->X_op;
|
|
|
12f9d8 |
+ incv.X_add_symbol = p_view->X_add_symbol;
|
|
|
12f9d8 |
+ incv.X_add_number = p_view->X_add_number + 1;
|
|
|
12f9d8 |
+ }
|
|
|
12f9d8 |
|
|
|
12f9d8 |
if (viewx.X_op == O_constant)
|
|
|
12f9d8 |
{
|