2007-04-12 H.J. Lu <hongjiu.lu@intel.com>
authorH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Apr 2007 19:20:46 +0000 (19:20 +0000)
committerH.J. Lu <hjl.tools@gmail.com>
Thu, 12 Apr 2007 19:20:46 +0000 (19:20 +0000)
PR binutils/4348
* objcopy.c (copy_object): Don't stop when there are no
sections to be copied.

testsuite/

2007-04-12  H.J. Lu  <hongjiu.lu@intel.com>

PR binutils/4348
* binutils-all/empty.s: New file.
* binutils-all/strip-3.d: Likewise.

* binutils-all/objcopy.exp: Run strip-3 for ELF target.

binutils/ChangeLog
binutils/objcopy.c
binutils/testsuite/ChangeLog
binutils/testsuite/binutils-all/empty.s [new file with mode: 0644]
binutils/testsuite/binutils-all/objcopy.exp
binutils/testsuite/binutils-all/strip-3.d [new file with mode: 0644]

index 83dc368d43659225e11612a5bb5c66bcc6c7fd87..a45c46b8148bcc12515cebf7794ceb6b0e6490f5 100644 (file)
@@ -1,3 +1,9 @@
+2007-04-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/4348
+       * objcopy.c (copy_object): Don't stop when there are no
+       sections to be copied.
+
 2007-04-10  Vladimir Prus  <vladimir@codesourcery.com>
 
        * NEWS: Mention disjoint histograms support in
index c955e37bbd565368ac533d7fb539a12c48414050..d02b3e0e0b46c9eca35e65a2282c321cb992c287 100644 (file)
@@ -1521,13 +1521,8 @@ copy_object (bfd *ibfd, bfd *obfd)
        }
     }
 
-  if (bfd_count_sections (obfd) == 0)
-    {
-      non_fatal (_("there are no sections to be copied!"));
-      return FALSE;
-    }
-
-  if (gap_fill_set || pad_to_set)
+  if (bfd_count_sections (obfd) != 0
+      && (gap_fill_set || pad_to_set))
     {
       asection **set;
       unsigned int c, i;
index 27e5a10d5bd0917b7fb1a6abd2a9a4920ec1cdf2..13e37e3f0c5e9d239f891936bac01eb48a537637 100644 (file)
@@ -1,3 +1,11 @@
+2007-04-12  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR binutils/4348
+       * binutils-all/empty.s: New file.
+       * binutils-all/strip-3.d: Likewise.
+
+       * binutils-all/objcopy.exp: Run strip-3 for ELF target.
+
 2007-02-27  Nathan Sidwell  <nathan@codesourcery.com>
 
        * binutils-all/objcopy.exp: Skip for uclinux targets.
diff --git a/binutils/testsuite/binutils-all/empty.s b/binutils/testsuite/binutils-all/empty.s
new file mode 100644 (file)
index 0000000..8690c06
--- /dev/null
@@ -0,0 +1 @@
+# An empty file.
index d782e9b7b79ff6e39b25d434d7eac0389177ab7d..cc56b4f14596246fd5bde35d916bb09ce70bb23c 100644 (file)
@@ -737,5 +737,6 @@ if [is_elf_format] {
     run_dump_test "localize-hidden-1"
     run_dump_test "strip-1"
     run_dump_test "strip-2"
+    run_dump_test "strip-3"
 }
 run_dump_test "localize-hidden-2"
diff --git a/binutils/testsuite/binutils-all/strip-3.d b/binutils/testsuite/binutils-all/strip-3.d
new file mode 100644 (file)
index 0000000..6d2b451
--- /dev/null
@@ -0,0 +1,11 @@
+#PROG: strip
+#source: empty.s
+#strip: -R .text -R .data -R .bss
+#readelf: -S --wide
+#name: strip empty file
+#target: *-*-linux*
+
+#...
+  \[[ 0]+\][ \t]+NULL[ \t]+.*
+  \[[ 1]+\] \.shstrtab.*[ \t]+STRTAB[ \t]+.*
+#pass
This page took 0.045357 seconds and 4 git commands to generate.