]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol
authorHans-Peter Nilsson <hp@bitrange.com>
Wed, 15 Jul 2020 04:22:28 +0000 (06:22 +0200)
committerHans-Peter Nilsson <hp@bitrange.com>
Wed, 15 Jul 2020 18:16:27 +0000 (20:16 +0200)
commit131af83de30f8a87bfdf323010ea923368d290e2
tree13a0f3288fb6eed21102e440c51a47e482e3abb8
parentae310391c7d68c50778b3dad73678ee8f972f1f1
mmix bfd: fix bfd_assert for R_MMIX_PUSHJ_STUBBABLE against undef'd symbol

Spotted when inspecting gcc testsuite logs, but this already is
covered by the ld-mmix testsuite, it's just that the assert is ignored
since the regexp match is for a substring and not anchored.

With the anchors added but not the bugfix, the ld.log shows that the
asserts cause a non-match as intended:

Executing on host: sh -c {./ld-new   -LX/src/ld/testsuite/ld-mmix  -m elf64mmix -o tmpdir/dump tmpdir/undef-2.o tmpdir/start.o  2>&1}  /dev/null dump.tmp (timeout = 300)
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'
failed with: <./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: BFD (GNU Binutils) 2.34.50.20200629 assertion fail X/src/bfd/elf64-mmix.c:2845
./ld-new: tmpdir/undef-2.o:(.text+0x0): undefined reference to `undefd'>, expected: <\A[^\n\r]*undefined reference to `undefd'\Z>
FAIL: ld-mmix/undef-2

Gone with the fix of course, leaving just the intended "undefined
reference" line.

I'm not going to add anchors manually for all the "error:" strings in
the test-suite, not even in the mmix parts.  Sorry, but I'll just do
it for *these* specific undefined-reference tests.

Just a thought: maybe the run_dump_test "error:" string should
*automatically* get anchor marks prepended and appended for a single
line match as in the patch, "\A[^\n\r]*" prepended and \Z appended
unless either anchor mark or \r or \n is present in the regexp?

Committed.

bfd:
* elf64-mmix.c (mmix_elf_relax_section): Improve accounting for
R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols.

ld/testsuite:
* testsuite/ld-mmix/undef-1.d, testsuite/ld-mmix/undef-1m.d,
testsuite/ld-mmix/undef-2.d, testsuite/ld-mmix/undef-2m.d: Add
start- and end-anchors to error-string to match just a
single-line error-message.

(cherry picked from commit a8a48c756c0da3a49008662e14ae582764ddd0bb)
bfd/ChangeLog
bfd/elf64-mmix.c
ld/ChangeLog
ld/testsuite/ld-mmix/undef-1.d
ld/testsuite/ld-mmix/undef-1m.d
ld/testsuite/ld-mmix/undef-2.d
ld/testsuite/ld-mmix/undef-2m.d