binutils ChangeLog:
authorBob Wilson <bob.wilson@acm.org>
Mon, 17 May 2004 16:40:01 +0000 (16:40 +0000)
committerBob Wilson <bob.wilson@acm.org>
Mon, 17 May 2004 16:40:01 +0000 (16:40 +0000)
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.

22 files changed:
bfd/ChangeLog
bfd/aout-target.h
bfd/aout-tic30.c
bfd/bfd-in2.h
bfd/bfd.c
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/elf-bfd.h
bfd/elf.c
bfd/elfxx-target.h
bfd/libbfd-in.h
bfd/libbfd.h
bfd/libecoff.h
bfd/mach-o.c
bfd/mmo.c
bfd/ppcboot.c
bfd/som.c
bfd/targets.c
bfd/vms.c
binutils/ChangeLog
binutils/objcopy.c

index b4b1d91aedc694746eff3e2d10bc3d7d2d859a06..b5364ed2ba1be28f6a919a5ce96e3d6b0d612360 100644 (file)
@@ -1,3 +1,28 @@
+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.
+
 2004-05-15  Thiemo Seufer  <seufer@csv.ica.uni-stuttgart.de>
 
        * elfxx-mips.c (MINUS_TWO): Define.
 2004-05-15  Thiemo Seufer  <seufer@csv.ica.uni-stuttgart.de>
 
        * elfxx-mips.c (MINUS_TWO): Define.
index 80513c7c739f8506f3578ab97baa6857991cf747..fd344a45d599333043aed3a0ed1f72a6def97fee 100644 (file)
@@ -559,6 +559,10 @@ MY_bfd_final_link (abfd, info)
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
+#ifndef MY_bfd_copy_private_header_data
+#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#endif
+
 #ifndef MY_bfd_print_private_bfd_data
 #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 #endif
 #ifndef MY_bfd_print_private_bfd_data
 #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 #endif
index 1ae0ebfdab91d429f3b8beb0d4f5ed2afc7a1b66..af99c4bde99827ecef75b533bc13b621fa966c5b 100644 (file)
@@ -1016,6 +1016,10 @@ tic30_aout_set_arch_mach (abfd, arch, machine)
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
+#ifndef MY_bfd_copy_private_header_data
+#define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
+#endif
+
 #ifndef MY_bfd_print_private_bfd_data
 #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 #endif
 #ifndef MY_bfd_print_private_bfd_data
 #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 #endif
index ee194f986c6446923b6b3c18b1ad366922f2022c..3f38b6a5b45cbe9d0cdfcd2e3af6843a6defc1f1 100644 (file)
@@ -3945,6 +3945,11 @@ void bfd_set_gp_size (bfd *abfd, unsigned int i);
 
 bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
 
 
 bfd_vma bfd_scan_vma (const char *string, const char **end, int base);
 
+bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
+
+#define bfd_copy_private_header_data(ibfd, obfd) \
+     BFD_SEND (obfd, _bfd_copy_private_header_data, \
+               (ibfd, obfd))
 bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
 
 #define bfd_copy_private_bfd_data(ibfd, obfd) \
 bfd_boolean bfd_copy_private_bfd_data (bfd *ibfd, bfd *obfd);
 
 #define bfd_copy_private_bfd_data(ibfd, obfd) \
@@ -4225,6 +4230,7 @@ typedef struct bfd_target
   NAME##_bfd_merge_private_bfd_data, \
   NAME##_bfd_copy_private_section_data, \
   NAME##_bfd_copy_private_symbol_data, \
   NAME##_bfd_merge_private_bfd_data, \
   NAME##_bfd_copy_private_section_data, \
   NAME##_bfd_copy_private_symbol_data, \
+  NAME##_bfd_copy_private_header_data, \
   NAME##_bfd_set_private_flags, \
   NAME##_bfd_print_private_bfd_data
 
   NAME##_bfd_set_private_flags, \
   NAME##_bfd_print_private_bfd_data
 
@@ -4242,6 +4248,10 @@ typedef struct bfd_target
      to another.  */
   bfd_boolean (*_bfd_copy_private_symbol_data)
     (bfd *, asymbol *, bfd *, asymbol *);
      to another.  */
   bfd_boolean (*_bfd_copy_private_symbol_data)
     (bfd *, asymbol *, bfd *, asymbol *);
+  /* Called to copy BFD private header data from one object file
+     to another.  */
+  bfd_boolean (*_bfd_copy_private_header_data)
+    (bfd *, bfd *);
   /* Called to set private backend flags.  */
   bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
 
   /* Called to set private backend flags.  */
   bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
 
index e184781f5fd395c9884fda06b03cff06ff310e60..3ead0ee5b5ac7bbd758610fe4756bdf1b27f883c 100644 (file)
--- a/bfd/bfd.c
+++ b/bfd/bfd.c
@@ -980,6 +980,29 @@ bfd_scan_vma (const char *string, const char **end, int base)
   return value;
 }
 
   return value;
 }
 
+/*
+FUNCTION
+       bfd_copy_private_header_data
+
+SYNOPSIS
+       bfd_boolean bfd_copy_private_header_data (bfd *ibfd, bfd *obfd);
+
+DESCRIPTION
+       Copy private BFD header information from the BFD @var{ibfd} to the
+       the BFD @var{obfd}.  This copies information that may require
+       sections to exist, but does not require symbol tables.  Return
+       <<true>> on success, <<false>> on error.
+       Possible error returns are:
+
+       o <<bfd_error_no_memory>> -
+       Not enough memory exists to create private data for @var{obfd}.
+
+.#define bfd_copy_private_header_data(ibfd, obfd) \
+.     BFD_SEND (obfd, _bfd_copy_private_header_data, \
+.              (ibfd, obfd))
+
+*/
+
 /*
 FUNCTION
        bfd_copy_private_bfd_data
 /*
 FUNCTION
        bfd_copy_private_bfd_data
index 22d47c561bf06deca36f2f8dd57cd93aec22345e..cbd3a914c37567ecc4056c15bf80c0f5588e4d86 100644 (file)
@@ -4142,6 +4142,7 @@ const bfd_target rs6000coff_vec =
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+    ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
@@ -4386,6 +4387,7 @@ const bfd_target pmac_xcoff_vec =
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+    ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
index 857a4b45c36d83133b66ed2ee1b77f438d9338ae..678ba9380b3affdae90363f9193d8c049e2e2860 100644 (file)
@@ -2683,6 +2683,7 @@ const bfd_target rs6000coff64_vec =
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+    ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
@@ -2928,6 +2929,7 @@ const bfd_target aix5coff64_vec =
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
     ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true),
     ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true),
+    ((bfd_boolean (*) (bfd *, bfd *)) bfd_true),
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
     ((bfd_boolean (*) (bfd *, flagword)) bfd_true),
     ((bfd_boolean (*) (bfd *, void * )) bfd_true),
 
index 35da7c9054d1d9e2e3cee0fc68e0a35b9467bc2d..d50744695fd4e5bf2153486de17a098f6d306866 100644 (file)
@@ -5511,6 +5511,10 @@ static const bfd_coff_backend_data ticoff1_swap_table =
 #define coff_bfd_copy_private_symbol_data   _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
 #define coff_bfd_copy_private_symbol_data   _bfd_generic_bfd_copy_private_symbol_data
 #endif
 
+#ifndef coff_bfd_copy_private_header_data
+#define coff_bfd_copy_private_header_data   _bfd_generic_bfd_copy_private_header_data
+#endif
+
 #ifndef coff_bfd_copy_private_section_data
 #define coff_bfd_copy_private_section_data  _bfd_generic_bfd_copy_private_section_data
 #endif
 #ifndef coff_bfd_copy_private_section_data
 #define coff_bfd_copy_private_section_data  _bfd_generic_bfd_copy_private_section_data
 #endif
index 750cc1c675b5feb721977e43f3bbabf2145c25cc..82da5bb2babb0b82e925a76d440bedc4eace7132 100644 (file)
@@ -1379,6 +1379,8 @@ extern void bfd_elf_set_group_contents
   (bfd *, asection *, void *);
 extern void _bfd_elf_link_just_syms
   (asection *, struct bfd_link_info *);
   (bfd *, asection *, void *);
 extern void _bfd_elf_link_just_syms
   (asection *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_copy_private_header_data
+  (bfd *, bfd *);
 extern bfd_boolean _bfd_elf_copy_private_symbol_data
   (bfd *, asymbol *, bfd *, asymbol *);
 extern bfd_boolean _bfd_elf_copy_private_section_data
 extern bfd_boolean _bfd_elf_copy_private_symbol_data
   (bfd *, asymbol *, bfd *, asymbol *);
 extern bfd_boolean _bfd_elf_copy_private_section_data
index 8e208c22e60292a159c3cc3cbe8ab0f4ca1b012e..0317e354a7703153052600d12e2e48fe60de7fc8 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -5290,24 +5290,6 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
       || obfd->xvec->flavour != bfd_target_elf_flavour)
     return TRUE;
 
       || obfd->xvec->flavour != bfd_target_elf_flavour)
     return TRUE;
 
-  if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
-    {
-       asection *s;
-
-       /* Only set up the segments if there are no more SEC_ALLOC
-          sections.  FIXME: This won't do the right thing if objcopy is
-          used to remove the last SEC_ALLOC section, since objcopy
-          won't call this routine in that case.  */
-       for (s = isec->next; s != NULL; s = s->next)
-         if ((s->flags & SEC_ALLOC) != 0)
-           break;
-       if (s == NULL)
-         {
-           if (! copy_private_bfd_data (ibfd, obfd))
-             return FALSE;
-         }
-    }
-
   ihdr = &elf_section_data (isec)->this_hdr;
   ohdr = &elf_section_data (osec)->this_hdr;
 
   ihdr = &elf_section_data (isec)->this_hdr;
   ohdr = &elf_section_data (osec)->this_hdr;
 
@@ -5330,6 +5312,29 @@ _bfd_elf_copy_private_section_data (bfd *ibfd,
   return TRUE;
 }
 
   return TRUE;
 }
 
+/* Copy private header information.  */
+
+bfd_boolean
+_bfd_elf_copy_private_header_data (bfd *ibfd, bfd *obfd)
+{
+  if (bfd_get_flavour (ibfd) != bfd_target_elf_flavour
+      || bfd_get_flavour (obfd) != bfd_target_elf_flavour)
+    return TRUE;
+
+  /* Copy over private BFD data if it has not already been copied.
+     This must be done here, rather than in the copy_private_bfd_data
+     entry point, because the latter is called after the section
+     contents have been set, which means that the program headers have
+     already been worked out.  */
+  if (elf_tdata (obfd)->segment_map == NULL && elf_tdata (ibfd)->phdr != NULL)
+    {
+      if (! copy_private_bfd_data (ibfd, obfd))
+       return FALSE;
+    }
+
+  return TRUE;
+}
+
 /* Copy private symbol information.  If this symbol is in a section
    which we did not map into a BFD section, try to map the section
    index correctly.  We use special macro definitions for the mapped
 /* Copy private symbol information.  If this symbol is in a section
    which we did not map into a BFD section, try to map the section
    index correctly.  We use special macro definitions for the mapped
index 61ed19788f8d720022c42aab298091ad38a6103d..d0773e57bcc71d0dedad2ba323ded129f42caf50 100644 (file)
 #define bfd_elfNN_bfd_copy_private_section_data \
   _bfd_elf_copy_private_section_data
 #endif
 #define bfd_elfNN_bfd_copy_private_section_data \
   _bfd_elf_copy_private_section_data
 #endif
+#ifndef bfd_elfNN_bfd_copy_private_header_data
+#define bfd_elfNN_bfd_copy_private_header_data \
+  _bfd_elf_copy_private_header_data
+#endif
 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
 #define bfd_elfNN_bfd_copy_private_bfd_data \
   _bfd_elf_copy_private_bfd_data
 #ifndef bfd_elfNN_bfd_copy_private_bfd_data
 #define bfd_elfNN_bfd_copy_private_bfd_data \
   _bfd_elf_copy_private_bfd_data
index fb021d3b03464fe7f6be051949d32868d10ca3d5..6d3a335eafbc24ac6856eb62345fa227e1c8b064 100644 (file)
@@ -212,6 +212,8 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window
   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
 #define _bfd_generic_bfd_copy_private_symbol_data \
   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
 #define _bfd_generic_bfd_copy_private_symbol_data \
   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
+#define _bfd_generic_bfd_copy_private_header_data \
+  ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
 #define _bfd_generic_bfd_print_private_bfd_data \
   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
 
 #define _bfd_generic_bfd_print_private_bfd_data \
   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
 
index 6841e29b8e0fd3b37661ae5de04801e5f12555e6..86819ff03e211771c1d6085d82a70f63d01cc19e 100644 (file)
@@ -217,6 +217,8 @@ extern bfd_boolean _bfd_generic_get_section_contents_in_window
   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
 #define _bfd_generic_bfd_copy_private_symbol_data \
   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
   ((bfd_boolean (*) (bfd *, asection *, bfd *, asection *)) bfd_true)
 #define _bfd_generic_bfd_copy_private_symbol_data \
   ((bfd_boolean (*) (bfd *, asymbol *, bfd *, asymbol *)) bfd_true)
+#define _bfd_generic_bfd_copy_private_header_data \
+  ((bfd_boolean (*) (bfd *, bfd *)) bfd_true)
 #define _bfd_generic_bfd_print_private_bfd_data \
   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
 
 #define _bfd_generic_bfd_print_private_bfd_data \
   ((bfd_boolean (*) (bfd *, void *)) bfd_true)
 
@@ -696,9 +698,9 @@ struct _bfd_window_internal {
 extern bfd *bfd_last_cache;
 
 #define bfd_cache_lookup(x) \
 extern bfd *bfd_last_cache;
 
 #define bfd_cache_lookup(x) \
-    ((x)==bfd_last_cache? \
-      (FILE*) (bfd_last_cache->iostream): \
-       bfd_cache_lookup_worker(x))
+    ((x) == bfd_last_cache ? \
+      (FILE *) (bfd_last_cache->iostream): \
+       bfd_cache_lookup_worker (x))
 bfd_boolean bfd_cache_init (bfd *abfd);
 
 bfd_boolean bfd_cache_close (bfd *abfd);
 bfd_boolean bfd_cache_init (bfd *abfd);
 
 bfd_boolean bfd_cache_close (bfd *abfd);
index 7d4006a951f3369e901e1e1135e55c3d89126e9b..b809f3a06618fcadc66257f68bbc737efba2a9ab 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD ECOFF object file private structure.
 /* BFD ECOFF object file private structure.
-   Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003
+   Copyright 1993, 1994, 1995, 1996, 1999, 2001, 2002, 2003, 2004
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
    Free Software Foundation, Inc.
    Written by Ian Lance Taylor, Cygnus Support.
 
@@ -249,6 +249,9 @@ extern bfd_boolean _bfd_ecoff_bfd_copy_private_bfd_data
 #define _bfd_ecoff_bfd_copy_private_symbol_data \
   _bfd_generic_bfd_copy_private_symbol_data
 
 #define _bfd_ecoff_bfd_copy_private_symbol_data \
   _bfd_generic_bfd_copy_private_symbol_data
 
+#define _bfd_ecoff_bfd_copy_private_header_data \
+  _bfd_generic_bfd_copy_private_header_data
+
 #define _bfd_ecoff_bfd_print_private_bfd_data \
   _bfd_generic_bfd_print_private_bfd_data
 
 #define _bfd_ecoff_bfd_print_private_bfd_data \
   _bfd_generic_bfd_print_private_bfd_data
 
index eaa7aba88a4adc94035513264d23cc65713232d4..b2401c4359c839cda271e4d8293c7b3243efc2d9 100644 (file)
@@ -70,6 +70,7 @@
 #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections
 #define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_section
 #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group
 #define bfd_mach_o_bfd_merge_sections bfd_generic_merge_sections
 #define bfd_mach_o_bfd_is_group_section bfd_generic_is_group_section
 #define bfd_mach_o_bfd_discard_group bfd_generic_discard_group
+#define bfd_mach_o_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
 
 static bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data
   PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
 
 static bfd_boolean bfd_mach_o_bfd_copy_private_symbol_data
   PARAMS ((bfd *, asymbol *, bfd *, asymbol *));
index d791062ecc3356ca98624b226fb536556f3b7a65..fc6c21330f106ec99bc11a568315bd0f9d9df9db 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3306,6 +3306,7 @@ mmo_canonicalize_reloc (abfd, section, relptr, symbols)
 #define mmo_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define mmo_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define mmo_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #define mmo_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define mmo_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define mmo_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
+#define mmo_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
 #define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 #define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 
 #define mmo_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 #define mmo_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
 
index d34f1a2777e253dc4ac9c7e9f263762b5f4b5c2e..cc4dc2774109aaeffaf5dae2522b127691ac584e 100644 (file)
@@ -484,6 +484,7 @@ ppcboot_bfd_print_private_bfd_data (abfd, farg)
 #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define ppcboot_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define ppcboot_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
+#define ppcboot_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
 #define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 #define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data
 
 #define ppcboot_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 #define ppcboot_bfd_print_private_bfd_dat ppcboot_bfd_print_private_bfd_data
 
index 899a8a293d2e646835e01dccbec1df0f1fed3b0f..e05d4af81bfe1c42723a6068c4e0eb18376015c7 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -192,6 +192,8 @@ static bfd_boolean som_bfd_copy_private_section_data
   PARAMS ((bfd *, asection *, bfd *, asection *));
 static bfd_boolean som_bfd_copy_private_bfd_data
   PARAMS ((bfd *, bfd *));
   PARAMS ((bfd *, asection *, bfd *, asection *));
 static bfd_boolean som_bfd_copy_private_bfd_data
   PARAMS ((bfd *, bfd *));
+#define som_bfd_copy_private_header_data \
+  _bfd_generic_bfd_copy_private_header_data
 #define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 static bfd_boolean som_bfd_is_local_label_name
 #define som_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #define som_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
 static bfd_boolean som_bfd_is_local_label_name
index ad6362abfcaec094ef160db2786713e8282bc150..bceb724e22def83a3f069889967d02e1fe47036b 100644 (file)
@@ -265,6 +265,7 @@ BFD_JUMP_TABLE macros.
 .  NAME##_bfd_merge_private_bfd_data, \
 .  NAME##_bfd_copy_private_section_data, \
 .  NAME##_bfd_copy_private_symbol_data, \
 .  NAME##_bfd_merge_private_bfd_data, \
 .  NAME##_bfd_copy_private_section_data, \
 .  NAME##_bfd_copy_private_symbol_data, \
+.  NAME##_bfd_copy_private_header_data, \
 .  NAME##_bfd_set_private_flags, \
 .  NAME##_bfd_print_private_bfd_data
 .
 .  NAME##_bfd_set_private_flags, \
 .  NAME##_bfd_print_private_bfd_data
 .
@@ -282,6 +283,10 @@ BFD_JUMP_TABLE macros.
 .     to another.  *}
 .  bfd_boolean (*_bfd_copy_private_symbol_data)
 .    (bfd *, asymbol *, bfd *, asymbol *);
 .     to another.  *}
 .  bfd_boolean (*_bfd_copy_private_symbol_data)
 .    (bfd *, asymbol *, bfd *, asymbol *);
+.  {* Called to copy BFD private header data from one object file
+.     to another.  *}
+.  bfd_boolean (*_bfd_copy_private_header_data)
+.    (bfd *, bfd *);
 .  {* Called to set private backend flags.  *}
 .  bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
 .
 .  {* Called to set private backend flags.  *}
 .  bfd_boolean (*_bfd_set_private_flags) (bfd *, flagword);
 .
index 329b0564ad87fb0d178c45d1b438ecac621841b4..f6d3c1a7f542d0fa888055575a8db5ba8013491a 100644 (file)
--- a/bfd/vms.c
+++ b/bfd/vms.c
@@ -168,6 +168,8 @@ static bfd_boolean vms_bfd_set_private_flags
 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
 #define vms_bfd_is_group_section bfd_generic_is_group_section
 #define vms_bfd_discard_group bfd_generic_discard_group
 #define vms_bfd_link_just_syms _bfd_generic_link_just_syms
 #define vms_bfd_is_group_section bfd_generic_is_group_section
 #define vms_bfd_discard_group bfd_generic_discard_group
+#define vms_bfd_copy_private_header_data \
+  _bfd_generic_bfd_copy_private_header_data
 \f
 /*===========================================================================*/
 
 \f
 /*===========================================================================*/
 
index 0cbdf4ba28f30ecd17dc6c7ceaa1bcaf57a99a34..2dab43f08b8d5dfb6bc0651dca45b5a84b7e0658 100644 (file)
@@ -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
 2004-05-13  Paul Brook  <paul@codesourcery.com>
 
        * readelf.c (display_debug_frames): Handle dwarf3 format CIE
index aad68ad7dfdc0c4398a8a6f83c1a79be649b3393..839d27bc17b4fb68687b5a73bc33689257bda7e4 100644 (file)
@@ -377,6 +377,7 @@ extern unsigned long          bfd_external_machine;
 
 /* Forward declarations.  */
 static void setup_section (bfd *, asection *, void *);
 
 /* 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 *);
 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);
 
      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;
   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;
 }
 
   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.  */
 
 /* Create a section in OBFD with the same
    name and attributes as ISECTION in IBFD.  */
 
This page took 0.065709 seconds and 4 git commands to generate.