summaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-05-11 14:09:50 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-05-11 14:09:50 +0000
commit919fa2e35d3873fea517c9050d3478f967e60f31 (patch)
treed11acf258b54873b571e337be0b1ffbc09c12728 /binutils/objcopy.c
parent9ea1b9942c7e8c27a9e2f4e222dc02e47b145441 (diff)
downloadbinutils-redhat-919fa2e35d3873fea517c9050d3478f967e60f31.tar.gz
PR 4479
* objcopy.c (copy_object): Don't copy ELF program headers for --only-keep-debug.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index ef57c2bf4a..a841e014d4 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -1423,7 +1423,12 @@ copy_object (bfd *ibfd, bfd *obfd)
any output is done. Thus, we traverse all sections multiple times. */
bfd_map_over_sections (ibfd, setup_section, obfd);
- setup_bfd_headers (ibfd, obfd);
+ /* Don't copy headers when creating an ELF format debug info file. */
+ if (bfd_get_flavour (ibfd) == bfd_target_elf_flavour
+ && strip_symbols == STRIP_NONDEBUG)
+ ;
+ else
+ setup_bfd_headers (ibfd, obfd);
if (add_sections != NULL)
{