aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-10-20 00:02:17 +1030
committerAlan Modra <amodra@gmail.com>2018-10-20 19:46:43 +1030
commitac85e67c053f1555def2c111962f4e68740794f9 (patch)
treeae87b3fee90369f867b84c97b24903b863d03a58 /bfd
parent91ae256e33f7c068443d877fe3e2b2ffd91cf60b (diff)
downloadgdb-ac85e67c053f1555def2c111962f4e68740794f9.zip
gdb-ac85e67c053f1555def2c111962f4e68740794f9.tar.gz
gdb-ac85e67c053f1555def2c111962f4e68740794f9.tar.bz2
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.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/elf.c18
2 files changed, 15 insertions, 9 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 0178d97..31ff3d6 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+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-10-17 Alan Modra <amodra@gmail.com>
PR 23653
diff --git a/bfd/elf.c b/bfd/elf.c
index 5b3d27c..764c61f 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