From: "H. J. Lu" <hjl@lucon.org>
To: binutils@sources.redhat.com
Subject: PATCH: PR binutils/4348: strip can't strip sections
Date: Thu, 12 Apr 2007 06:36:00 -0000 [thread overview]
Message-ID: <20070412040843.GA8868@lucon.org> (raw)
I don't see why objcopy should stop when there are no sections to be
copied. After all, the resulting output file is still valid ELF
file.
H.J.
----
2007-04-11 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.
testsuite/
2007-04-11 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/objcopy.c.empty 2007-03-01 14:53:10.000000000 -0800
+++ binutils/objcopy.c 2007-04-11 21:03:26.000000000 -0700
@@ -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;
--- binutils/testsuite/binutils-all/empty.s.empty 2007-04-11 20:57:11.000000000 -0700
+++ binutils/testsuite/binutils-all/empty.s 2007-04-11 20:56:56.000000000 -0700
@@ -0,0 +1 @@
+# An empty file.
--- binutils/testsuite/binutils-all/objcopy.exp.empty 2007-04-11 20:18:51.000000000 -0700
+++ binutils/testsuite/binutils-all/objcopy.exp 2007-04-11 21:02:23.000000000 -0700
@@ -744,5 +744,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"
--- binutils/testsuite/binutils-all/strip-3.d.empty 2007-04-11 20:57:46.000000000 -0700
+++ binutils/testsuite/binutils-all/strip-3.d 2007-04-11 21:01:15.000000000 -0700
@@ -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
next reply other threads:[~2007-04-12 4:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-04-12 6:36 H. J. Lu [this message]
2007-04-12 13:22 ` Nick Clifton
2007-04-12 15:00 ` H. J. Lu
2007-04-12 20:35 ` Nick Clifton
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070412040843.GA8868@lucon.org \
--to=hjl@lucon.org \
--cc=binutils@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).