]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR23788, objcopy: failed to find link section
authorAlan Modra <amodra@gmail.com>
Fri, 19 Oct 2018 13:32:17 +0000 (00:02 +1030)
committerAlan Modra <amodra@gmail.com>
Wed, 12 Dec 2018 01:13:02 +0000 (11:43 +1030)
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)

bfd/ChangeLog
bfd/elf.c

index d62a1fe3061e1760157168403616fc43d3b512e5..4486ee89eb660ffefa0b0126913dd3d70b24530d 100644 (file)
@@ -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
index 80410575b09b0476c00c5e592963e4020dd7259a..828241d48af23621464c1abde2325f194aa7ed08 100644 (file)
--- 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