aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorRichard Sandiford <rdsandiford@googlemail.com>2006-10-19 13:47:10 +0000
committerRichard Sandiford <rdsandiford@googlemail.com>2006-10-19 13:47:10 +0000
commit6870500c0404a6501f0a21fdbca6ce2695c6ca0c (patch)
tree407c9393cb1e04270007ead3a0681c8c54f9836f /bfd
parent6a4837657a02883bda341796fe407ee988cd0695 (diff)
downloadgdb-6870500c0404a6501f0a21fdbca6ce2695c6ca0c.zip
gdb-6870500c0404a6501f0a21fdbca6ce2695c6ca0c.tar.gz
gdb-6870500c0404a6501f0a21fdbca6ce2695c6ca0c.tar.bz2
bfd/
* elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the same symbol by increasing r_offset. (sort_dynamic_relocs_64): Likewise. Fix comparisons between very large and very small symbol indexes. ld/testsuite/ * ld-mips-elf/tlslib-o32-hidden.got: Sort relocations against the same symbol in order of increasing r_offset. * ld-mips-elf/tls-multi-got-1.got: Likewise. * ld-mips-elf/tls-hidden3.r: Likewise. * ld-mips-elf/tls-hidden4.r: Likewise.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfxx-mips.c23
2 files changed, 27 insertions, 3 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 7919e95..14cc5cb 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,12 @@
2006-10-19 Richard Sandiford <richard@codesourcery.com>
+ * elfxx-mips.c (sort_dynamic_relocs): Sort relocations against the
+ same symbol by increasing r_offset.
+ (sort_dynamic_relocs_64): Likewise. Fix comparisons between very
+ large and very small symbol indexes.
+
+2006-10-19 Richard Sandiford <richard@codesourcery.com>
+
* elfxx-mips.c (_bfd_mips_elf_size_dynamic_sections): Add DT_DEBUG
and DT_MIPS_RLD_MAP tags for position-independent executables.
Do not add DT_DEBUG to shared libraries for any MIPS target.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index aea0273..33b0e43 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -1692,11 +1692,20 @@ sort_dynamic_relocs (const void *arg1, const void *arg2)
{
Elf_Internal_Rela int_reloc1;
Elf_Internal_Rela int_reloc2;
+ int diff;
bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg1, &int_reloc1);
bfd_elf32_swap_reloc_in (reldyn_sorting_bfd, arg2, &int_reloc2);
- return ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
+ diff = ELF32_R_SYM (int_reloc1.r_info) - ELF32_R_SYM (int_reloc2.r_info);
+ if (diff != 0)
+ return diff;
+
+ if (int_reloc1.r_offset < int_reloc2.r_offset)
+ return -1;
+ if (int_reloc1.r_offset > int_reloc2.r_offset)
+ return 1;
+ return 0;
}
/* Like sort_dynamic_relocs, but used for elf64 relocations. */
@@ -1714,8 +1723,16 @@ sort_dynamic_relocs_64 (const void *arg1 ATTRIBUTE_UNUSED,
(*get_elf_backend_data (reldyn_sorting_bfd)->s->swap_reloc_in)
(reldyn_sorting_bfd, arg2, int_reloc2);
- return (ELF64_R_SYM (int_reloc1[0].r_info)
- - ELF64_R_SYM (int_reloc2[0].r_info));
+ if (ELF64_R_SYM (int_reloc1[0].r_info) < ELF64_R_SYM (int_reloc2[0].r_info))
+ return -1;
+ if (ELF64_R_SYM (int_reloc1[0].r_info) > ELF64_R_SYM (int_reloc2[0].r_info))
+ return 1;
+
+ if (int_reloc1[0].r_offset < int_reloc2[0].r_offset)
+ return -1;
+ if (int_reloc1[0].r_offset > int_reloc2[0].r_offset)
+ return 1;
+ return 0;
#else
abort ();
#endif