summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Peter Nilsson <hp@axis.com>2002-02-09 05:04:27 +0000
committerHans-Peter Nilsson <hp@axis.com>2002-02-09 05:04:27 +0000
commit10301df635538e6dda1a43c50df8b21e2f61aed7 (patch)
tree22137817a73ea5bdf8a91cca586bc462cebbaf8e
parent1d5e16776e24245882083c968ac6ddd70c8d54c7 (diff)
downloadgdb-10301df635538e6dda1a43c50df8b21e2f61aed7.tar.gz
* elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check
that base-plus-offset reloc accounting is consistent. (mmix_elf_relax_section): Keep base-plus-offset reloc accounting up to date for undefined symbols.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elf64-mmix.c25
2 files changed, 28 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 750fea195a1..bf5854df4e4 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2002-02-09 Hans-Peter Nilsson <hp@bitrange.com>
+
+ * elf64-mmix.c (_bfd_mmix_finalize_linker_allocated_gregs): Check
+ that base-plus-offset reloc accounting is consistent.
+ (mmix_elf_relax_section): Keep base-plus-offset reloc accounting
+ up to date for undefined symbols.
+
2002-02-08 Eric Christopher <echristo@redhat.com>
From Rainer Orth <ro@TechFak.Uni-Bielefeld.DE>
diff --git a/bfd/elf64-mmix.c b/bfd/elf64-mmix.c
index c547c4b55c8..3bda435c987 100644
--- a/bfd/elf64-mmix.c
+++ b/bfd/elf64-mmix.c
@@ -2177,6 +2177,21 @@ _bfd_mmix_finalize_linker_allocated_gregs (abfd, link_info)
if (contents == NULL)
return false;
+ /* Sanity check: If these numbers mismatch, some relocation has not been
+ accounted for and the rest of gregdata is probably inconsistent.
+ It's a bug, but it's more helpful to identify it than segfaulting
+ below. */
+ if (gregdata->n_remaining_bpo_relocs_this_relaxation_round
+ != gregdata->n_bpo_relocs)
+ {
+ (*_bfd_error_handler)
+ (_("Internal inconsistency: remaining %u != max %u.\n\
+ Please report this bug."),
+ gregdata->n_remaining_bpo_relocs_this_relaxation_round,
+ gregdata->n_bpo_relocs);
+ return false;
+ }
+
for (lastreg = 255, i = 0, j = 0; j < n_gregs; i++)
if (gregdata->reloc_request[i].regindex != lastreg)
{
@@ -2287,7 +2302,6 @@ mmix_elf_relax_section (abfd, sec, link_info, again)
struct bfd_link_info *link_info;
boolean *again;
{
-
Elf_Internal_Shdr *symtab_hdr;
Elf_Internal_Shdr *shndx_hdr;
Elf_Internal_Rela *internal_relocs;
@@ -2431,9 +2445,12 @@ mmix_elf_relax_section (abfd, sec, link_info, again)
if (h->root.type != bfd_link_hash_defined
&& h->root.type != bfd_link_hash_defweak)
{
- /* This appears to be a reference to an undefined
- symbol. Just ignore it--it will be caught by the
- regular reloc processing. */
+ /* This appears to be a reference to an undefined symbol.
+ Just ignore it--it will be caught by the regular reloc
+ processing. We need to keep BPO reloc accounting
+ consistent, though. */
+ gregdata->n_remaining_bpo_relocs_this_relaxation_round--;
+ bpono++;
continue;
}