diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 813e3f219bf..321e2e060bd 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-07-15 Hans-Peter Nilsson + + * elf64-mmix.c (mmix_elf_relax_section): Improve accounting for + R_MMIX_PUSHJ_STUBBABLE relocs against undefined symbols. + 2020-07-15 Markus Böck Alan Modra diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c index fee4a0fbd78..2fc491c5ffa 100644 --- a/bfd/elf64-mmix.c +++ b/bfd/elf64-mmix.c @@ -2538,6 +2538,7 @@ mmix_elf_relax_section (bfd *abfd, spot a missing actual initialization. */ size_t bpono = (size_t) -1; size_t pjsno = 0; + size_t pjsno_undefs = 0; Elf_Internal_Sym *isymbuf = NULL; bfd_size_type size = sec->rawsize ? sec->rawsize : sec->size; @@ -2703,6 +2704,11 @@ mmix_elf_relax_section (bfd *abfd, gregdata->n_remaining_bpo_relocs_this_relaxation_round--; bpono++; } + + /* Similarly, keep accounting consistent for PUSHJ + referring to an undefined symbol. */ + if (ELF64_R_TYPE (irel->r_info) == R_MMIX_PUSHJ_STUBBABLE) + pjsno_undefs++; continue; } } @@ -2842,7 +2848,8 @@ mmix_elf_relax_section (bfd *abfd, } } - BFD_ASSERT(pjsno == mmix_elf_section_data (sec)->pjs.n_pushj_relocs); + BFD_ASSERT(pjsno + pjsno_undefs + == mmix_elf_section_data (sec)->pjs.n_pushj_relocs); if (elf_section_data (sec)->relocs != internal_relocs) free (internal_relocs); diff --git a/ld/ChangeLog b/ld/ChangeLog index 98d10c0b73a..b667566a889 100644 --- a/ld/ChangeLog +++ b/ld/ChangeLog @@ -1,3 +1,10 @@ +2020-07-15 Hans-Peter Nilsson + + * 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. + 2020-07-13 Alan Modra * testsuite/ld-scripts/default-script1.d: Don't skip, xfail diff --git a/ld/testsuite/ld-mmix/undef-1.d b/ld/testsuite/ld-mmix/undef-1.d index fb8c7ee03a0..ad8d757683e 100644 --- a/ld/testsuite/ld-mmix/undef-1.d +++ b/ld/testsuite/ld-mmix/undef-1.d @@ -1,4 +1,4 @@ #source: undef-1.s #source: start.s #ld: -m elf64mmix -#error: undefined reference to `regvar' +#error: \A[^\n\r]*undefined reference to `regvar'\Z diff --git a/ld/testsuite/ld-mmix/undef-1m.d b/ld/testsuite/ld-mmix/undef-1m.d index 001d7f64b87..e747e5026cc 100644 --- a/ld/testsuite/ld-mmix/undef-1m.d +++ b/ld/testsuite/ld-mmix/undef-1m.d @@ -1,4 +1,4 @@ #source: undef-1.s #source: start.s #ld: -m mmo -#error: undefined reference to `regvar' +#error: \A[^\n\r]*undefined reference to `regvar'\Z diff --git a/ld/testsuite/ld-mmix/undef-2.d b/ld/testsuite/ld-mmix/undef-2.d index 52844dbad44..2dc2b4e4d57 100644 --- a/ld/testsuite/ld-mmix/undef-2.d +++ b/ld/testsuite/ld-mmix/undef-2.d @@ -2,4 +2,4 @@ #source: start.s #as: -x #ld: -m elf64mmix -#error: undefined reference to `undefd' +#error: \A[^\n\r]*undefined reference to `undefd'\Z diff --git a/ld/testsuite/ld-mmix/undef-2m.d b/ld/testsuite/ld-mmix/undef-2m.d index aa0becc251e..7eb3c673c62 100644 --- a/ld/testsuite/ld-mmix/undef-2m.d +++ b/ld/testsuite/ld-mmix/undef-2m.d @@ -2,4 +2,4 @@ #source: start.s #as: -x #ld: -m mmo -#error: undefined reference to `undefd' +#error: \A[^\n\r]*undefined reference to `undefd'\Z