Simplify the assembler's evaluation of chained .loc view expressions.

Resolves: #2059646
This commit is contained in:
Nick Clifton 2022-03-09 13:56:31 +00:00
parent d685480361
commit c074b4afae
2 changed files with 71 additions and 5 deletions

View File

@ -0,0 +1,59 @@
Only in binutils-2.38/gas: #dwarf2dbg.c#
Only in binutils-2.38/gas: .#dwarf2dbg.c
diff -rup binutils.orig/gas/symbols.c binutils-2.38/gas/symbols.c
--- binutils.orig/gas/symbols.c 2022-03-09 11:43:34.706610216 +0000
+++ binutils-2.38/gas/symbols.c 2022-03-09 11:45:57.540686508 +0000
@@ -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);
}
@@ -784,7 +786,9 @@ symbol_clone (symbolS *orgsymP, int repl
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;
@@ -837,6 +841,7 @@ symbol_clone_if_forward_ref (symbolS *sy
symbolP->x->value.X_add_symbol = add_symbol;
symbolP->x->value.X_op_symbol = op_symbol;
+ symbolP->flags.forward_resolved = 1;
}
return symbolP;
diff -rup binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d
--- binutils.orig/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:43:34.487611632 +0000
+++ binutils-2.38/gas/testsuite/gas/elf/dwarf2-18.d 2022-03-09 11:48:03.298873228 +0000
@@ -2,9 +2,8 @@
#readelf: -x.rodata -wL
#name: DWARF2 18
# The am33 cr16 crx ft32 mn10 msp430 nds32 and rl78 targets do not evaluate the subtraction of symbols at assembly time.
-# The mep targets turns some view computations into complex relocations.
# The riscv targets do not support the subtraction of symbols.
-#xfail: am3*-* cr16-* crx-* ft32*-* mep-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
+#xfail: am3*-* cr16-* crx-* ft32*-* mn10*-* msp430-* nds32*-* riscv*-* rl78-*
Hex dump of section '\.rodata':
0x00000000 0100 *.*

View File

@ -39,7 +39,7 @@
Summary: A GNU collection of binary utilities Summary: A GNU collection of binary utilities
Name: binutils%{?name_cross}%{?_with_debug:-debug} Name: binutils%{?name_cross}%{?_with_debug:-debug}
Version: 2.38 Version: 2.38
Release: 3%{?dist} Release: 4%{?dist}
License: GPLv3+ License: GPLv3+
URL: https://sourceware.org/binutils URL: https://sourceware.org/binutils
@ -236,21 +236,21 @@ Patch08: binutils-2.27-aarch64-ifunc.patch
Patch09: binutils-do-not-link-with-static-libstdc++.patch Patch09: binutils-do-not-link-with-static-libstdc++.patch
# Purpose: Allow OS specific sections in section groups. # Purpose: Allow OS specific sections in section groups.
# Lifetime: Fixed in 2.38 (maybe) # Lifetime: Fixed in 2.39 (maybe)
Patch10: binutils-special-sections-in-groups.patch Patch10: binutils-special-sections-in-groups.patch
# Purpose: Fix linker testsuite failures. # Purpose: Fix linker testsuite failures.
# Lifetime: Fixed in 2.37 (maybe) # Lifetime: Fixed in 2.39 (maybe)
Patch11: binutils-fix-testsuite-failures.patch Patch11: binutils-fix-testsuite-failures.patch
# Purpose: Stop gold from aborting when input sections with the same name # Purpose: Stop gold from aborting when input sections with the same name
# have different flags. # have different flags.
# Lifetime: Fixed in 2.38 (maybe) # Lifetime: Fixed in 2.39 (maybe)
Patch12: binutils-gold-mismatched-section-flags.patch Patch12: binutils-gold-mismatched-section-flags.patch
# Purpose: Add a check to the GOLD linker for a corrupt input file # Purpose: Add a check to the GOLD linker for a corrupt input file
# with a fuzzed section offset. # with a fuzzed section offset.
# Lifetime: Fixed in 2.38 (maybe) # Lifetime: Fixed in 2.39 (maybe)
Patch13: binutils-CVE-2019-1010204.patch Patch13: binutils-CVE-2019-1010204.patch
# Purpose: Change the gold configuration script to only warn about # Purpose: Change the gold configuration script to only warn about
@ -289,6 +289,10 @@ Patch19: gcc12-libtool-no-rpath.patch
# Lifetime: Fixed in 2.39 # Lifetime: Fixed in 2.39
Patch20: binutils-section-type.patch Patch20: binutils-section-type.patch
# Purpose: Simplify the evaluation of assembler loc view expression chains.
# Lifetime: Fixed in 2.39
Patch21: binutils-gas-loc-view.patch
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
Provides: bundled(libiberty) Provides: bundled(libiberty)
@ -902,6 +906,9 @@ exit 0
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
%changelog %changelog
* Wed Mar 09 2022 Nick Clifton <nickc@redhat.comn> - 2.38-4
- Simplify the assembler's evaluation of chained .loc view expressions. (#2059646)
* Mon Feb 28 2022 Nick Clifton <nickc@redhat.comn> - 2.38-3 * Mon Feb 28 2022 Nick Clifton <nickc@redhat.comn> - 2.38-3
- Do not export any windows tools (if they were built). (#2057636) - Do not export any windows tools (if they were built). (#2057636)