--- binutils/objcopy.c.orig 2015-10-12 20:55:35.789243991 +0200 +++ binutils/objcopy.c 2015-10-12 21:02:37.764968069 +0200 @@ -472,7 +472,7 @@ /* Forward declarations. */ static void setup_section (bfd *, asection *, void *); -static void setup_bfd_headers (bfd *, bfd *); +static void setup_bfd_headers (bfd *, bfd *, int); static void copy_relocations_in_section (bfd *, asection *, void *); static void copy_section (bfd *, asection *, void *); static void get_sections (bfd *, asection *, void *); @@ -1756,8 +1756,7 @@ any output is done. Thus, we traverse all sections multiple times. */ bfd_map_over_sections (ibfd, setup_section, obfd); - if (!extract_symbol) - setup_bfd_headers (ibfd, obfd); + setup_bfd_headers (ibfd, obfd, !extract_symbol); if (add_sections != NULL) { @@ -2624,11 +2623,13 @@ finalization work for private section headers. Do that here. */ static void -setup_bfd_headers (bfd *ibfd, bfd *obfd) +setup_bfd_headers (bfd *ibfd, bfd *obfd, int data) { /* Allow the BFD backend to copy any private data it understands from the input section to the output section. */ - if (! bfd_copy_private_header_data (ibfd, obfd)) + + if (! (data?bfd_copy_private_header_data (ibfd, obfd): + bfd_copy_private_bfd_data(ibfd, obfd))) { status = 1; bfd_nonfatal_message (NULL, ibfd, NULL,