+2015-08-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/18785
+ * elf.c (_bfd_elf_copy_private_bfd_data): When copying the
+ sh_link and sh_info fields in stripped section headers, we also
+ check if the sh_type, sh_flags, /sh_addralign and sh_entsize
+ fields of the output section match the output. Since
+ --only-keep-debug turns all non-debug sections into SHT_NOBITS
+ sections, the output SHT_NOBITS type matches any input type.
+
2015-08-07 H.J. Lu <hongjiu.lu@intel.com>
PR ld/18720
{
Elf_Internal_Shdr * iheader = iheaders[j];
- if (iheader->sh_type != SHT_NOBITS
+ /* Since --only-keep-debug turns all non-debug sections
+ into SHT_NOBITS sections, the output SHT_NOBITS type
+ matches any input type. */
+ if ((oheader->sh_type == SHT_NOBITS
+ || oheader->sh_type == oheader->sh_type)
+ && iheader->sh_flags == oheader->sh_flags
+ && iheader->sh_addralign == oheader->sh_addralign
+ && iheader->sh_entsize == oheader->sh_entsize
&& iheader->sh_size == oheader->sh_size
&& iheader->sh_addr == oheader->sh_addr
&& (iheader->sh_info != oheader->sh_info
+2015-08-07 H.J. Lu <hongjiu.lu@intel.com>
+
+ PR binutils/18785
+ * binutils-all/objcopy.exp: Run strip-12.
+ * binutils-all/strip-12.d: New file.
+ * binutils-all/strip-12.s: Likewise.
+
2015-08-07 Andrew Burgess <andrew.burgess@embecosm.com>
* binutils-all/objcopy.exp: Run new symbol tests.
run_dump_test "strip-7"
run_dump_test "strip-8"
run_dump_test "strip-9"
+ run_dump_test "strip-12"
# Non-EABI ARM targets will set OSABI to ARM
# The V850 sets the OSABI to UNIX - System V
if { ![istarget "*-*-hpux*"]
--- /dev/null
+#PROG: strip
+#strip:
+#readelf: -S --wide
+
+#...
+ \[[ 0-9]+\] \.bss[ \t]+NOBITS[ \t0-9a-f]+WA[ \t]+0[ \t]+0[ \t]+1
+#pass
--- /dev/null
+ .bss
+ .space 8
+ .section .debug_str,"MS",%progbits,1
+ .string ""
+ .section .text.foo,"axG",%progbits,foo,comdat
+ .byte 0