summaryrefslogtreecommitdiff
path: root/binutils/objcopy.c
diff options
context:
space:
mode:
authorBob Wilson <bob.wilson@acm.org>2004-05-17 16:40:01 +0000
committerBob Wilson <bob.wilson@acm.org>2004-05-17 16:40:01 +0000
commitad59c688cffc85c69e88483aa845877690839f96 (patch)
tree8259703b9a8d10d326eb8d667a359eaa2dd8ae02 /binutils/objcopy.c
parent893f3c86a58bc52fce0af520c8c543716002d8c2 (diff)
downloadbinutils-redhat-ad59c688cffc85c69e88483aa845877690839f96.tar.gz
binutils ChangeLog:
2004-05-17 David Heine <dlheine@tensilica.com> * objcopy.c (setup_bfd_headers): New function. (copy_object): Call setup_bfd_headers. bfd ChangeLog: 2004-05-17 David Heine <dlheine@tensilica.com> * aout-target.h (MY_bfd_copy_private_header_data): Define. * aout-tic30.c (MY_bfd_copy_private_header_data): Define. * bfd.c (bfd_copy_private_header_data): Define. * coff-rs6000.c (rs6000coff_vec, pmac_xcoff_vec): Add entries for new interface. * coff64-rs6000.c (rs6000coff64_vec, aix5coff64_vec): Likewise. * coffcode.h (coff_bfd_copy_private_header_data): Define. * elf-bfd.h (_bfd_elf_copy_private_header_data): Declare. * elf.c (_bfd_elf_copy_private_section_data): Remove code to set up segments by calling copy_private_bfd_data. (_bfd_elf_copy_private_header_data): Define. * elfxx-target.h (bfd_elfNN_bfd_copy_private_header_data): Define. * libbfd-in.h (_bfd_generic_bfd_copy_private_header_data): Define. * libecoff.h (_bfd_ecoff_bfd_copy_private_header_data): Define. * mach-o.c (bfd_mach_o_bfd_copy_private_header_data): Define. * mmo.c (mmo_bfd_copy_private_header_data): Define. * ppcboot.c (ppcboot_bfd_copy_private_header_data): Define. * som.c (som_bfd_copy_private_header_data): Define. * targets.c (BFD_JUMP_TABLE_COPY): Add _bfd_copy_private_header_data. * vms.c (vms_bfd_copy_private_header_data): Define. * bfd-in2.h: Regenerate. * libbfd.h: Regenerate.
Diffstat (limited to 'binutils/objcopy.c')
-rw-r--r--binutils/objcopy.c29
1 files changed, 29 insertions, 0 deletions
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index aad68ad7df..839d27bc17 100644
--- a/binutils/objcopy.c
+++ b/binutils/objcopy.c
@@ -377,6 +377,7 @@ extern unsigned long bfd_external_machine;
/* Forward declarations. */
static void setup_section (bfd *, asection *, void *);
+static void setup_bfd_headers (bfd *, bfd *);
static void copy_section (bfd *, asection *, void *);
static void get_sections (bfd *, asection *, void *);
static int compare_section_lma (const void *, const void *);
@@ -1178,6 +1179,8 @@ 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);
+
if (add_sections != NULL)
{
struct section_add *padd;
@@ -1808,6 +1811,32 @@ find_section_rename (bfd * ibfd ATTRIBUTE_UNUSED, sec_ptr isection,
return old_name;
}
+/* Once each of the sections is copied, we may still need to do some
+ finalization work for private section headers. Do that here. */
+
+static void
+setup_bfd_headers (bfd *ibfd, bfd *obfd)
+{
+ const char *err;
+
+ /* 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))
+ {
+ err = _("private header data");
+ goto loser;
+ }
+
+ /* All went well. */
+ return;
+
+loser:
+ non_fatal (_("%s: error in %s: %s"),
+ bfd_get_filename (ibfd),
+ err, bfd_errmsg (bfd_get_error ()));
+ status = 1;
+}
+
/* Create a section in OBFD with the same
name and attributes as ISECTION in IBFD. */