From 8adb2e35e23a7c7f92cfea362da2380dfc67c91f Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Fri, 11 May 2007 14:09:50 +0000 Subject: [PATCH] PR 4479 * objcopy.c (copy_object): Don't copy ELF program headers for --only-keep-debug. --- binutils/ChangeLog | 6 ++++++ binutils/objcopy.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/binutils/ChangeLog b/binutils/ChangeLog index f5f0b58faf..6affdfdff0 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,9 @@ +2007-05-11 Alan Modra + + PR 4479 + * objcopy.c (copy_object): Don't copy ELF program headers for + --only-keep-debug. + 2007-05-11 Alan Modra * embedspu.sh (find_prog): Prefer prog in same dir as embedspu 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) {