aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2017-05-02 16:54:53 +0100
committerNick Clifton <nickc@redhat.com>2017-05-02 16:55:31 +0100
commit1395c6ce47510babad3dcb9892f6f2517a3f2b59 (patch)
tree675f764a25ddd1a9cbb36f53ad38eaa4ee2391e2 /binutils/objcopy.c
parent73ec947d59c511411377ad51ef792a5fcdd3f0cc (diff)
downloadgdb-1395c6ce47510babad3dcb9892f6f2517a3f2b59.zip
gdb-1395c6ce47510babad3dcb9892f6f2517a3f2b59.tar.gz
gdb-1395c6ce47510babad3dcb9892f6f2517a3f2b59.tar.bz2
Don't merge notes when the relocs associated with them cannot be reliably deleted.
* objcopy.c (merge_gnu_build_notes): Disable merge if there are more internal relocs than external relocs.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index 42c7775..36952ec 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -2137,6 +2137,13 @@ merge_gnu_build_notes (bfd * abfd, asection * sec, bfd_size_type size, bfd_byte
relcount = 0;
}
+ /* A few targets (eg MIPS, SPARC) create multiple internal relocs to
+ represent a single external reloc. Unfortunately the current BFD
+ API does not handle deleting relocs in such situations very well
+ and so it is unsafe to proceed. */
+ if (relcount > sec->reloc_count)
+ goto done;
+
/* Eliminate the duplicates. */
new = new_contents = xmalloc (size);
for (pnote = pnotes, old = contents;