This is the mail archive of the binutils-cvs@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[binutils-gdb/binutils-2_25-branch] Delete unnecessary code copying SHF_SH5_ISA32 flag


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=d2aa5e8b6a3e1b7d6f2cc358ca6c45943ff84f64

commit d2aa5e8b6a3e1b7d6f2cc358ca6c45943ff84f64
Author: Alan Modra <amodra@gmail.com>
Date:   Fri Dec 26 18:26:38 2014 +1030

    Delete unnecessary code copying SHF_SH5_ISA32 flag
    
    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.

Diff:
---
 bfd/ChangeLog                               |  5 +++++
 bfd/elf64-sh64.c                            | 21 ---------------------
 binutils/testsuite/ChangeLog                |  7 +++++++
 binutils/testsuite/binutils-all/objcopy.exp |  6 ++++++
 binutils/testsuite/binutils-all/strip-11.d  | 12 ++++++++++++
 5 files changed, 30 insertions(+), 21 deletions(-)

diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 75ef959..78d5de0 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,6 +1,11 @@
 2015-02-11  Alan Modra  <amodra@gmail.com>
 
 	Apply from master.
+	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-23  Alan Modra  <amodra@gmail.com>
 	* elflink.c (_bfd_elf_define_linkage_sym): Set linker_def.
 	* linker.c (_bfd_generic_link_add_one_symbol): Clear linker_def
diff --git a/bfd/elf64-sh64.c b/bfd/elf64-sh64.c
index 7497929..79cab57 100644
--- a/bfd/elf64-sh64.c
+++ b/bfd/elf64-sh64.c
@@ -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);
   
diff --git a/binutils/testsuite/ChangeLog b/binutils/testsuite/ChangeLog
index 2a4185e..8e541c0 100644
--- a/binutils/testsuite/ChangeLog
+++ b/binutils/testsuite/ChangeLog
@@ -1,3 +1,10 @@
+2015-02-11  Alan Modra  <amodra@gmail.com>
+
+	Apply from master.
+	2014-12-26  Alan Modra  <amodra@gmail.com>
+	* binutils-all/strip-11.d: New test.
+	* binutils-all/objcopy.exp: Run it.
+
 2014-09-12  Andrew Bennett  <andrew.bennett@imgtec.com>
 
 	* binutils-all/objcopy.exp: Add mips*-img-elf* target triple.
diff --git a/binutils/testsuite/binutils-all/objcopy.exp b/binutils/testsuite/binutils-all/objcopy.exp
index 49d466d..3066491 100644
--- a/binutils/testsuite/binutils-all/objcopy.exp
+++ b/binutils/testsuite/binutils-all/objcopy.exp
@@ -959,6 +959,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
index 0000000..04c47ab
--- /dev/null
+++ b/binutils/testsuite/binutils-all/strip-11.d
@@ -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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]