aboutsummaryrefslogtreecommitdiff
path: root/binutils
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
commit80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d (patch)
tree37e972e1e55e1a0d2b94dd6198e53f0567008a27 /binutils
parentcea96d64fe6299c4fd45291fe7ccc49215363322 (diff)
downloadgdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.zip
gdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.tar.gz
gdb-80fccad2d4ce82a2ed9a5d8d081eb2daefa09f9d.tar.bz2
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')
-rw-r--r--binutils/ChangeLog5
-rw-r--r--binutils/objcopy.c29
2 files changed, 34 insertions, 0 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog
index 0cbdf4b..2dab43f 100644
--- a/binutils/ChangeLog
+++ b/binutils/ChangeLog
@@ -1,3 +1,8 @@
+2004-05-17 David Heine <dlheine@tensilica.com>
+
+ * objcopy.c (setup_bfd_headers): New function.
+ (copy_object): Call setup_bfd_headers.
+
2004-05-13 Paul Brook <paul@codesourcery.com>
* readelf.c (display_debug_frames): Handle dwarf3 format CIE
diff --git a/binutils/objcopy.c b/binutils/objcopy.c
index aad68ad..839d27b 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. */