summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej W. Rozycki <macro@linux-mips.org>2010-11-04 18:00:54 +0000
committerMaciej W. Rozycki <macro@linux-mips.org>2010-11-04 18:00:54 +0000
commit21d790b94321db1f489df1e51b97e0a7377e7b24 (patch)
tree5eef39a692376b94f0b53b2fc4910b6ab0bc0cfb
parentdd7f9124e97e5a72beba9b34a7ff5e384b9c159d (diff)
downloadbinutils-gdb-21d790b94321db1f489df1e51b97e0a7377e7b24.tar.gz
PR ld/10144
* elfxx-mips.c (_bfd_mips_elf_check_relocs) [R_MIPS_32, R_MIPS_REL32, R_MIPS_64]: Ignore relocs from SEC_DEBUGGING sections.
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/elfxx-mips.c19
2 files changed, 26 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index f18a7ddf7f8..50d311dfed0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+2010-11-04 Maciej W. Rozycki <macro@codesourcery.com>
+
+ PR ld/10144
+ * elfxx-mips.c (_bfd_mips_elf_check_relocs)
+ [R_MIPS_32, R_MIPS_REL32, R_MIPS_64]: Ignore relocs from
+ SEC_DEBUGGING sections.
+
2010-11-04 Tristan Gingold <gingold@adacore.com>
* vms-lib.c (vms_write_index): Fix thinko: reverse the loop.
diff --git a/bfd/elfxx-mips.c b/bfd/elfxx-mips.c
index bed8ed1ff08..4718dd4db67 100644
--- a/bfd/elfxx-mips.c
+++ b/bfd/elfxx-mips.c
@@ -7583,6 +7583,25 @@ _bfd_mips_elf_check_relocs (bfd *abfd, struct bfd_link_info *info,
elf_hash_table (info)->dynobj = dynobj = abfd;
break;
}
+ /* For sections that are not SEC_ALLOC a copy reloc would be
+ output if possible (implying questionable semantics for
+ read-only data objects) or otherwise the final link would
+ fail as ld.so will not process them and could not therefore
+ handle any outstanding dynamic relocations.
+
+ For such sections that are also SEC_DEBUGGING, we can avoid
+ these problems by simply ignoring any relocs as these
+ sections have a predefined use and we know it is safe to do
+ so.
+
+ This is needed in cases such as a global symbol definition
+ in a shared library causing a common symbol from an object
+ file to be converted to an undefined reference. If that
+ happens, then all the relocations against this symbol from
+ SEC_DEBUGGING sections in the object file will resolve to
+ nil. */
+ if ((sec->flags & SEC_DEBUGGING) != 0)
+ break;
/* Fall through. */
default: