aboutsummaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2007-05-11 14:09:50 +0000
committerAlan Modra <amodra@gmail.com>2007-05-11 14:09:50 +0000
commit8adb2e35e23a7c7f92cfea362da2380dfc67c91f (patch)
tree90dff2173deeb7319fa4e2524229b875b2a1f1e4 /binutils/objcopy.c
parent1aafd4da217bfefde7152bd8b99ee4a6a590aee0 (diff)
downloadgdb-8adb2e35e23a7c7f92cfea362da2380dfc67c91f.zip
gdb-8adb2e35e23a7c7f92cfea362da2380dfc67c91f.tar.gz
gdb-8adb2e35e23a7c7f92cfea362da2380dfc67c91f.tar.bz2
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 ef57c2b..a841e01 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)
{