]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Delete unnecessary code copying SHF_SH5_ISA32 flag
authorAlan Modra <amodra@gmail.com>
Fri, 26 Dec 2014 07:56:38 +0000 (18:26 +1030)
committerAlan Modra <amodra@gmail.com>
Fri, 26 Dec 2014 11:49:30 +0000 (22:19 +1030)
Since 2006, commit d270463e9, _bfd_elf_copy_private_section_data has
copied over SHF_MASKOS and SHF_MASKPROC flags.  That makes the buggy
code in sh_elf64_copy_private_data_internal redundant.

bfd/
PR 17755
* elf64-sh64.c (sh_elf64_copy_private_data_internal): Delete code
copying SHF_SH5_ISA32.
binutils/testsuite/
* binutils-all/strip-11.d: New test.
* binutils-all/objcopy.exp: Run it.

bfd/ChangeLog
bfd/elf64-sh64.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/strip-11.d [new file with mode: 0644]

index 8bfb2600e609f69e9016ef133709d4e774cc5c48..7b3a4740c1ec7878ffecbcdbe63bef39bef8d3eb 100644 (file)
@@ -1,3 +1,9 @@
+2014-12-26  Alan Modra  <amodra@gmail.com>
+
+       PR 17755
+       * elf64-sh64.c (sh_elf64_copy_private_data_internal): Delete code
+       copying SHF_SH5_ISA32.
+
 2014-12-25  Thomas Preud'homme  <thomas.preudhomme@arm.com>
 
        * elf32-arm.c (elf32_arm_merge_eabi_attributes): Handle new
index 74979293169ab70c1311ff266d9bbbbb62332abf..79cab578648d29dd7c26e295874b4ff568ddf877 100644 (file)
@@ -2259,31 +2259,10 @@ sh_elf64_set_private_flags (bfd *abfd, flagword flags)
 static bfd_boolean
 sh_elf64_copy_private_data_internal (bfd *ibfd, bfd *obfd)
 {
-  Elf_Internal_Shdr **o_shdrp;
-  asection *isec;
-  asection *osec;
-
   if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
       || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
     return TRUE;
 
-  o_shdrp = elf_elfsections (obfd);
-  for (osec = obfd->sections; osec; osec = osec->next)
-    {
-      int oIndex = ((struct bfd_elf_section_data *) elf_section_data (osec))->this_idx;
-      for (isec = ibfd->sections; isec; isec = isec->next)
-       {
-         if (strcmp (osec->name, isec->name) == 0)
-           {
-             /* Note that we're not disallowing mixing data and code.  */
-             if ((elf_section_data (isec)->this_hdr.sh_flags
-                  & SHF_SH5_ISA32) != 0)
-               o_shdrp[oIndex]->sh_flags |= SHF_SH5_ISA32;
-             break;
-           }
-       }
-    }
-
   /* Copy object attributes.  */
   _bfd_elf_copy_private_bfd_data (ibfd, obfd);
   
index 8576710d799311a303679b9e74c3281b3e59fca3..81d89c4cc1e91cd89b4a6c2c8c3707b353064535 100644 (file)
@@ -1,3 +1,8 @@
+2014-12-26  Alan Modra  <amodra@gmail.com>
+
+       * binutils-all/strip-11.d: New test.
+       * binutils-all/objcopy.exp: Run it.
+
 2014-12-06  Eric Botcazou  <ebotcazou@adacore.com>
 
        * binutils-all/objcopy.exp: Skip strip-10 for Visium.
index c83825a3d104134260687c6c59e91ef5b66589c1..e7b792efe1eec0511c2a738dfec4de32ffa5c5fa 100644 (file)
@@ -960,6 +960,12 @@ if [is_elf_format] {
          && !([istarget "arm*-*-*"] && ![istarget "arm-*-*eabi*"])} {
        run_dump_test "strip-10"
     }
+    set extra_strip11 ""
+    if { [istarget "sh64*-*"] } {
+       # pr17755 testcase
+       set extra_strip11 { { "as" "--isa=SHmedia --abi=64" } }
+    }
+    run_dump_test "strip-11" $extra_strip11
 
     if { [istarget "i*86-*"] || [istarget "x86_64-*-*"] } {
        # Check to make sure we don't strip a symbol named in relocations.
diff --git a/binutils/testsuite/binutils-all/strip-11.d b/binutils/testsuite/binutils-all/strip-11.d
new file mode 100644 (file)
index 0000000..04c47ab
--- /dev/null
@@ -0,0 +1,12 @@
+#PROG: strip
+#source: empty.s
+#strip: -g
+#readelf: -S --wide
+#name: strip -g empty file
+
+#...
+  \[ 0\] +NULL +0+ .*
+#...
+  \[ .\] \.shstrtab +STRTAB +0+ .*
+Key to Flags:
+#pass