]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix tight loop on recursively-defined symbols
authorAlan Modra <amodra@gmail.com>
Fri, 15 May 2020 08:36:05 +0000 (18:06 +0930)
committerAlan Modra <amodra@gmail.com>
Fri, 15 May 2020 08:52:11 +0000 (18:22 +0930)
commit5768460022b2928f1a5bd6d14dcc6176319a1c01
treee5aec579a951106634d796728553422cbbcc9424
parent68823a856b585d44b4fbd57d049d3afd5977f4a1
Fix tight loop on recursively-defined symbols

This patch fixes a bug in GAS where the assembler enters a tight loop
when attempting to resolve recursively-defined symbols, e.g. when
trying to assemble "a=a".

This is a regression introduced between binutils 2.32 and 2.33,
by commit 1903f1385bff9

* symbols.c (struct local_symbol): Update comment.
(resolve_symbol_value): For resolved symbols equated to other
symbols, verify that the referenced symbol is not a local_symbol
before accessing sy_value.  Don't leave symbol loops during
finalize_syms resolution.
* testsuite/gas/all/assign-bad-recursive.d: New test.
* testsuite/gas/all/assign-bad-recursive.l: Error output for test.
* testsuite/gas/all/assign-bad-recursive.s: Assembly for test.
* testsuite/gas/all/gas.exp: Run it.

(cherry picked from commit 2a50b401465f74d7f3ee1654915b9070b4dc0fee)
gas/ChangeLog
gas/symbols.c
gas/testsuite/gas/all/assign-bad-recursive.d [new file with mode: 0644]
gas/testsuite/gas/all/assign-bad-recursive.l [new file with mode: 0644]
gas/testsuite/gas/all/assign-bad-recursive.s [new file with mode: 0644]
gas/testsuite/gas/all/gas.exp