[PATCH] [GAS] Fix tight loop on recursively-defined symbols

Alex Coplan Alex.Coplan@arm.com
Thu May 14 14:28:00 GMT 2020


Hello,

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 bug appears to be a regression introduced between binutils 2.32 and 2.33,
specifically by this commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=1903f1385bff910861942743860d8577423bcb6c

Testing:
 * New unit test to hit this case and check the error output.
 * Clean testsuite run on x86_64, aarch64-none-elf, and arm-none-eabi.

OK for master and backport to binutils-2.34? If so, I will need a maintainer to
commit this on my behalf since I don't have commit access.

Thanks,
Alex

---

gas/ChangeLog:

2020-05-14  Alex Coplan  <alex.coplan@arm.com>
        * symbols.c (resolve_symbol_value): Fix symbol definition loop
        detection, don't spin.
        * 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.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: patch.txt
URL: <https://sourceware.org/pipermail/binutils/attachments/20200514/5a5bed0a/attachment.txt>


More information about the Binutils mailing list