[binutils-gdb/binutils-2_31-branch] PR23788, objcopy: failed to find link section
Alan Modra
amodra@sourceware.org
Wed Dec 12 01:13:00 GMT 2018
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=2e05e3e689f25b7b866c49435417b1ded33f7ac7
commit 2e05e3e689f25b7b866c49435417b1ded33f7ac7
Author: Alan Modra <amodra@gmail.com>
Date: Sat Oct 20 00:02:17 2018 +1030
PR23788, objcopy: failed to find link section
Symbol tables can change when a number of objcopy options are used.
I figure string tables are similarly changeable.
PR 23788
* elf.c (section_match): Don't require a size match for SHT_SYMTAB
or SHT_STRTAB.
(cherry picked from commit ac85e67c053f1555def2c111962f4e68740794f9)
Diff:
---
bfd/ChangeLog | 8 ++++++++
bfd/elf.c | 18 +++++++++---------
2 files changed, 17 insertions(+), 9 deletions(-)
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index d62a1fe..4486ee8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,11 @@
+2018-12-12 Alan Modra <amodra@gmail.com>
+
+ Apply from master
+ 2018-10-20 Alan Modra <amodra@gmail.com>
+ PR 23788
+ * elf.c (section_match): Don't require a size match for SHT_SYMTAB
+ or SHT_STRTAB.
+
2018-12-01 H.J. Lu <hongjiu.lu@intel.com>
PR ld/23929
diff --git a/bfd/elf.c b/bfd/elf.c
index 8041057..828241d 100644
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -1299,15 +1299,15 @@ static bfd_boolean
section_match (const Elf_Internal_Shdr * a,
const Elf_Internal_Shdr * b)
{
- return
- a->sh_type == b->sh_type
- && (a->sh_flags & ~ SHF_INFO_LINK)
- == (b->sh_flags & ~ SHF_INFO_LINK)
- && a->sh_addralign == b->sh_addralign
- && a->sh_size == b->sh_size
- && a->sh_entsize == b->sh_entsize
- /* FIXME: Check sh_addr ? */
- ;
+ if (a->sh_type != b->sh_type
+ || ((a->sh_flags ^ b->sh_flags) & ~SHF_INFO_LINK) != 0
+ || a->sh_addralign != b->sh_addralign
+ || a->sh_entsize != b->sh_entsize)
+ return FALSE;
+ if (a->sh_type == SHT_SYMTAB
+ || a->sh_type == SHT_STRTAB)
+ return TRUE;
+ return a->sh_size == b->sh_size;
}
/* Find a section in OBFD that has the same characteristics
More information about the Binutils-cvs
mailing list