]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
Merge init_private_section_data with copy_private_section_data
authorAlan Modra <amodra@gmail.com>
Tue, 8 Jul 2025 23:44:06 +0000 (09:14 +0930)
committerAlan Modra <amodra@gmail.com>
Wed, 9 Jul 2025 01:43:55 +0000 (11:13 +0930)
init_private_section_data is used by the linker and is a special case
of copy_private_section_data that copies a reduced set of section data
from input to output.  Merge the two functions, adding a link_info
param to copy_private_section_data and remove init_private_section_data.

28 files changed:
bfd/aout-target.h
bfd/bfd-in2.h
bfd/coff-rs6000.c
bfd/coff64-rs6000.c
bfd/coffcode.h
bfd/elf-bfd.h
bfd/elf.c
bfd/elf64-x86-64.c
bfd/elfxx-target.h
bfd/libbfd-in.h
bfd/libbfd.c
bfd/libbfd.h
bfd/libecoff.h
bfd/libpei.h
bfd/mach-o-target.c
bfd/mach-o.c
bfd/mach-o.h
bfd/mmo.c
bfd/peXXigen.c
bfd/plugin.c
bfd/ppcboot.c
bfd/section.c
bfd/som.c
bfd/targets.c
bfd/vms-alpha.c
binutils/objcopy.c
ld/ldlang.c
ld/ldwrite.c

index 1b711047f2887cb311e6bb6a0217f59337be97d8..c6d9d60ca8a6ec77369d9bff2edf8c456a44194a 100644 (file)
@@ -214,9 +214,11 @@ static bool
 MY_bfd_copy_private_section_data (bfd *ibfd,
                                  asection *isec ATTRIBUTE_UNUSED,
                                  bfd *obfd,
-                                 asection *osec ATTRIBUTE_UNUSED)
+                                 asection *osec ATTRIBUTE_UNUSED,
+                                 struct bfd_link_info *link_info)
 {
-  if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
+  if (link_info == NULL
+      && bfd_get_flavour (ibfd) == bfd_target_aout_flavour
       && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
     obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
   return true;
@@ -562,9 +564,6 @@ MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
 #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
 #endif
 
-#define MY_init_private_section_data \
-  _bfd_generic_init_private_section_data
-
 #ifndef MY_bfd_copy_private_symbol_data
 #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
 #endif
index d5d1b518bcc4506c90cd7b1bda283840003838d2..b013ef954da34a0b3c5a826e057691b0873efe25 100644 (file)
@@ -1034,11 +1034,12 @@ bool bfd_malloc_and_get_section
    (bfd *abfd, asection *section, bfd_byte **buf);
 
 bool bfd_copy_private_section_data
-   (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
+   (bfd *ibfd, asection *isec, bfd *obfd, asection *osec,
+    struct bfd_link_info *link_info);
 
-#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+#define bfd_copy_private_section_data(ibfd, isec, obfd, osec, link_info) \
        BFD_SEND (obfd, _bfd_copy_private_section_data, \
-                (ibfd, isection, obfd, osection))
+                (ibfd, isec, obfd, osec, link_info))
 bool bfd_generic_is_group_section (bfd *, const asection *sec);
 
 const char *bfd_generic_group_name (bfd *, const asection *sec);
@@ -7636,7 +7637,6 @@ typedef struct bfd_target
 #define BFD_JUMP_TABLE_COPY(NAME) \
   NAME##_bfd_copy_private_bfd_data, \
   NAME##_bfd_merge_private_bfd_data, \
-  NAME##_init_private_section_data, \
   NAME##_bfd_copy_private_section_data, \
   NAME##_bfd_copy_private_symbol_data, \
   NAME##_bfd_copy_private_header_data, \
@@ -7649,16 +7649,10 @@ typedef struct bfd_target
   /* Called to merge BFD general private data from one object file
      to a common output file when linking.  */
   bool (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *);
-  /* Called to initialize BFD private section data from one object file
-     to another.  */
-#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
-       BFD_SEND (obfd, _bfd_init_private_section_data, \
-                (ibfd, isec, obfd, osec, link_info))
-  bool (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
-                                         struct bfd_link_info *);
   /* Called to copy BFD private section data from one object file
      to another.  */
-  bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr);
+  bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
+                                         struct bfd_link_info *);
   /* Called to copy BFD private symbol data from one symbol
      to another.  */
   bool (*_bfd_copy_private_symbol_data) (bfd *, asymbol *,
index ae9a0f613abb94a808f25f14e06414fb2cea36ea..3c18518b0c81d07895a63acdf16cf7daa564199d 100644 (file)
@@ -4456,8 +4456,6 @@ const struct xcoff_dwsect_name xcoff_dwsect_names[] = {
 #define _bfd_xcoff_get_section_contents _bfd_generic_get_section_contents
 
 /* For copy private data entry points.  */
-#define _bfd_xcoff_init_private_section_data \
-  _bfd_generic_init_private_section_data
 #define _bfd_xcoff_bfd_copy_private_bfd_data \
   _bfd_xcoff_copy_private_bfd_data
 #define _bfd_xcoff_bfd_merge_private_bfd_data \
index ec7ed08d3d08fa5a0a13c28571ecbbb7cea303f0..d335348c19650c990b0b25febbaeb6e82313128a 100644 (file)
@@ -2621,7 +2621,6 @@ const bfd_target rs6000_xcoff64_vec =
     /* Copy */
     _bfd_xcoff_copy_private_bfd_data,
     _bfd_generic_bfd_merge_private_bfd_data,
-    _bfd_generic_init_private_section_data,
     _bfd_generic_bfd_copy_private_section_data,
     _bfd_generic_bfd_copy_private_symbol_data,
     _bfd_generic_bfd_copy_private_header_data,
@@ -2892,7 +2891,6 @@ const bfd_target rs6000_xcoff64_aix_vec =
     /* Copy */
     _bfd_xcoff_copy_private_bfd_data,
     _bfd_generic_bfd_merge_private_bfd_data,
-    _bfd_generic_init_private_section_data,
     _bfd_generic_bfd_copy_private_section_data,
     _bfd_generic_bfd_copy_private_symbol_data,
     _bfd_generic_bfd_copy_private_header_data,
index bd0374fbfdda09e7b82a29483c584a4d4bce2feb..b81195dd2ec5b95e9b9740510525436db40ab095 100644 (file)
@@ -5955,8 +5955,6 @@ static const bfd_coff_backend_data bigobj_swap_table =
 #define coff_bfd_copy_private_header_data   _bfd_generic_bfd_copy_private_header_data
 #endif
 
-#define coff_init_private_section_data     _bfd_generic_init_private_section_data
-
 #ifndef coff_bfd_copy_private_section_data
 #define coff_bfd_copy_private_section_data  _bfd_generic_bfd_copy_private_section_data
 #endif
index f62570919d540e89eaf1ffb47dab6c8f7e471b91..2bd855a936c756f11f28f8f595fb0a3b7f8de9d7 100644 (file)
@@ -2393,10 +2393,8 @@ extern bool _bfd_elf_copy_private_header_data
   (bfd *, bfd *);
 extern bool _bfd_elf_copy_private_symbol_data
   (bfd *, asymbol *, bfd *, asymbol *);
-extern bool _bfd_elf_init_private_section_data
-  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
 extern bool _bfd_elf_copy_private_section_data
-  (bfd *, asection *, bfd *, asection *);
+  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
 extern bool _bfd_elf_write_object_contents
   (bfd *);
 extern bool _bfd_elf_write_corefile_contents
index 07b2d0e5a2d8662b1979a5a0707106d06b5ee62c..1eba14283f831370bc08af19f4a6e155cdcb7145 100644 (file)
--- a/bfd/elf.c
+++ b/bfd/elf.c
@@ -8375,25 +8375,34 @@ copy_private_bfd_data (bfd *ibfd, bfd *obfd)
   return rewrite_elf_program_header (ibfd, obfd, maxpagesize);
 }
 
-/* Initialize private output section information from input section.  */
+/* Copy private section information from input to output.  This function
+   is called both by objcopy where LINK_INFO is NULL, and ld where
+   LINK_INFO is non-NULL in the usual case but NULL for a special case
+   when dealing with LTO IR or cloning output sections.  */
 
 bool
-_bfd_elf_init_private_section_data (bfd *ibfd,
+_bfd_elf_copy_private_section_data (bfd *ibfd,
                                    asection *isec,
                                    bfd *obfd,
                                    asection *osec,
                                    struct bfd_link_info *link_info)
-
 {
-  Elf_Internal_Shdr *ihdr, *ohdr;
-  bool final_link = (link_info != NULL
-                    && !bfd_link_relocatable (link_info));
-
   if (ibfd->xvec->flavour != bfd_target_elf_flavour
       || obfd->xvec->flavour != bfd_target_elf_flavour)
     return true;
 
-  BFD_ASSERT (elf_section_data (osec) != NULL);
+  Elf_Internal_Shdr *ihdr = &elf_section_data (isec)->this_hdr;
+  Elf_Internal_Shdr *ohdr = &elf_section_data (osec)->this_hdr;
+  if (link_info == NULL)
+    {
+      ohdr->sh_entsize = ihdr->sh_entsize;
+
+      if (ihdr->sh_type == SHT_SYMTAB
+         || ihdr->sh_type == SHT_DYNSYM
+         || ihdr->sh_type == SHT_GNU_verneed
+         || ihdr->sh_type == SHT_GNU_verdef)
+       ohdr->sh_info = ihdr->sh_info;
+    }
 
   /* If this is a known ABI section, ELF section type and flags may
      have been set up when OSEC was created.  For normal sections we
@@ -8403,11 +8412,14 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
       || elf_section_type (osec) == SHT_NOTE
       || elf_section_type (osec) == SHT_NOBITS)
     elf_section_type (osec) = SHT_NULL;
+
   /* For objcopy and relocatable link, copy the ELF section type from
      the input file if the BFD section flags are the same.  (If they
      are different the user may be doing something like
      "objcopy --set-section-flags .text=alloc,data".)  For a final
      link allow some flags that the linker clears to differ.  */
+  bool final_link = (link_info != NULL
+                    && !bfd_link_relocatable (link_info));
   if (elf_section_type (osec) == SHT_NULL
       && (osec->flags == isec->flags
          || (final_link
@@ -8445,14 +8457,11 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
     elf_section_flags (osec) |= (elf_section_flags (isec)
                                 & SHF_COMPRESSED);
 
-  ihdr = &elf_section_data (isec)->this_hdr;
-
   /* We need to handle elf_linked_to_section for SHF_LINK_ORDER. We
      don't use the output section of the linked-to section since it
      may be NULL at this point.  */
   if ((ihdr->sh_flags & SHF_LINK_ORDER) != 0)
     {
-      ohdr = &elf_section_data (osec)->this_hdr;
       ohdr->sh_flags |= SHF_LINK_ORDER;
       elf_linked_to_section (osec) = elf_linked_to_section (isec);
     }
@@ -8462,36 +8471,6 @@ _bfd_elf_init_private_section_data (bfd *ibfd,
   return true;
 }
 
-/* Copy private section information.  This copies over the entsize
-   field, and sometimes the info field.  */
-
-bool
-_bfd_elf_copy_private_section_data (bfd *ibfd,
-                                   asection *isec,
-                                   bfd *obfd,
-                                   asection *osec)
-{
-  Elf_Internal_Shdr *ihdr, *ohdr;
-
-  if (ibfd->xvec->flavour != bfd_target_elf_flavour
-      || obfd->xvec->flavour != bfd_target_elf_flavour)
-    return true;
-
-  ihdr = &elf_section_data (isec)->this_hdr;
-  ohdr = &elf_section_data (osec)->this_hdr;
-
-  ohdr->sh_entsize = ihdr->sh_entsize;
-
-  if (ihdr->sh_type == SHT_SYMTAB
-      || ihdr->sh_type == SHT_DYNSYM
-      || ihdr->sh_type == SHT_GNU_verneed
-      || ihdr->sh_type == SHT_GNU_verdef)
-    ohdr->sh_info = ihdr->sh_info;
-
-  return _bfd_elf_init_private_section_data (ibfd, isec, obfd, osec,
-                                            NULL);
-}
-
 /* Look at all the SHT_GROUP sections in IBFD, making any adjustments
    necessary if we are removing either the SHT_GROUP section or any of
    the group member sections.  DISCARDED is the value that a section's
index b9b3cf831c449304002266a11ac530f0fc0c8d8e..c40a0c5488a00b75dec5829f63be11a1e5421b1b 100644 (file)
@@ -6136,13 +6136,14 @@ elf_x86_64_fake_sections (bfd *abfd ATTRIBUTE_UNUSED,
 
 static bool
 elf_x86_64_copy_private_section_data (bfd *ibfd, asection *isec,
-                                     bfd *obfd, asection *osec)
+                                     bfd *obfd, asection *osec,
+                                     struct bfd_link_info *link_info)
 {
-  if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec))
+  if (!_bfd_elf_copy_private_section_data (ibfd, isec, obfd, osec, link_info))
     return false;
 
   /* objcopy --set-section-flags without "large" drops SHF_X86_64_LARGE.  */
-  if (ibfd != obfd)
+  if (link_info == NULL && ibfd != obfd)
     elf_section_flags (osec) &= ~SHF_X86_64_LARGE;
 
   return true;
index 625243cac948c431344b0baba418b1ddd8199a98..4cf02bbedd7e5270fa83f28ab3badb73f9d5b5d1 100644 (file)
   _bfd_elf_copy_private_symbol_data
 #endif
 
-#define bfd_elfNN_init_private_section_data \
-  _bfd_elf_init_private_section_data
 #ifndef bfd_elfNN_bfd_copy_private_section_data
 #define bfd_elfNN_bfd_copy_private_section_data \
   _bfd_elf_copy_private_section_data
index ae6d3039017a0b959d23bdd2b321097391231d29..213cc7d67595f91df415f0a23f0d1cd00b0b4406 100644 (file)
@@ -270,17 +270,14 @@ extern bool _bfd_generic_get_section_contents
 #define _bfd_generic_bfd_merge_private_bfd_data \
   _bfd_bool_bfd_link_true
 #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
-#define _bfd_generic_bfd_copy_private_section_data \
-  _bfd_bool_bfd_asection_bfd_asection_true
+extern bool _bfd_generic_bfd_copy_private_section_data
+  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
+  ATTRIBUTE_HIDDEN;
 #define _bfd_generic_bfd_copy_private_symbol_data \
   _bfd_bool_bfd_asymbol_bfd_asymbol_true
 #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
 #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
 
-extern bool _bfd_generic_init_private_section_data
-  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
-  ATTRIBUTE_HIDDEN;
-
 /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
    support.  Use BFD_JUMP_TABLE_CORE (_bfd_nocore).  */
 
index f2daf7977a0003eec5ad4f9df0e401b508e8bc1f..6587fc195f1afd332ad9a32a67cc5a2e9920e36e 100644 (file)
@@ -1514,11 +1514,11 @@ _bfd_write_unsigned_leb128 (bfd_byte *p, bfd_byte *end, bfd_vma val)
 }
 
 bool
-_bfd_generic_init_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
-                                       asection *isec ATTRIBUTE_UNUSED,
-                                       bfd *obfd ATTRIBUTE_UNUSED,
-                                       asection *osec ATTRIBUTE_UNUSED,
-                                       struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
+_bfd_generic_bfd_copy_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
+                                           asection *isec ATTRIBUTE_UNUSED,
+                                           bfd *obfd ATTRIBUTE_UNUSED,
+                                           asection *osec ATTRIBUTE_UNUSED,
+                                           struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
 {
   return true;
 }
index 3cb3c144228118516cbd51387a29a7162a0d64e0..bab1f71f7e3ff6570e546085622b299be22bb8f5 100644 (file)
@@ -276,17 +276,14 @@ extern bool _bfd_generic_get_section_contents
 #define _bfd_generic_bfd_merge_private_bfd_data \
   _bfd_bool_bfd_link_true
 #define _bfd_generic_bfd_set_private_flags _bfd_bool_bfd_uint_true
-#define _bfd_generic_bfd_copy_private_section_data \
-  _bfd_bool_bfd_asection_bfd_asection_true
+extern bool _bfd_generic_bfd_copy_private_section_data
+  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
+  ATTRIBUTE_HIDDEN;
 #define _bfd_generic_bfd_copy_private_symbol_data \
   _bfd_bool_bfd_asymbol_bfd_asymbol_true
 #define _bfd_generic_bfd_copy_private_header_data _bfd_bool_bfd_bfd_true
 #define _bfd_generic_bfd_print_private_bfd_data _bfd_bool_bfd_ptr_true
 
-extern bool _bfd_generic_init_private_section_data
-  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
-  ATTRIBUTE_HIDDEN;
-
 /* Routines to use for BFD_JUMP_TABLE_CORE when there is no core file
    support.  Use BFD_JUMP_TABLE_CORE (_bfd_nocore).  */
 
index 51a00e089733acf450efcddc54d86433f5c5177a..08b601d7264fa3176acdf0ac086f12da86bf971b 100644 (file)
@@ -250,9 +250,6 @@ extern bool _bfd_ecoff_get_section_contents
 #define _bfd_ecoff_bfd_link_split_section _bfd_generic_link_split_section
 #define _bfd_ecoff_bfd_link_check_relocs  _bfd_generic_link_check_relocs
 
-#define _bfd_ecoff_init_private_section_data \
-  _bfd_generic_init_private_section_data
-
 extern bool _bfd_ecoff_bfd_copy_private_bfd_data
   (bfd *, bfd *);
 #define _bfd_ecoff_bfd_copy_private_section_data \
index 4932fb1f9de110733abdf43d7ae6249c1cea3204..fc1ada251b6b0ba2a9585b7ead4efac3f99e9485 100644 (file)
@@ -473,7 +473,7 @@ CODEVIEW_INFO *_bfd_XXi_slurp_codeview_record
 unsigned _bfd_XX_only_swap_filehdr_out  (bfd *, void *, void *);
 unsigned _bfd_XXi_only_swap_filehdr_out (bfd *, void *, void *);
 bool _bfd_XX_bfd_copy_private_section_data
-  (bfd *, asection *, bfd *, asection *);
+  (bfd *, asection *, bfd *, asection *, struct bfd_link_info *);
 
 bool _bfd_pe_print_ce_compressed_pdata (bfd *, void *);
 bool _bfd_pe64_print_ce_compressed_pdata (bfd *, void *);
index fa1953fc4c4454bc42a7e6549fdaf7f36ea3cb88..e402d3a034f7d5c90468a0002cee1fd30341e3a1 100644 (file)
@@ -74,7 +74,6 @@
 #define bfd_mach_o_write_armap                   _bfd_noarchive_write_armap
 #define bfd_mach_o_get_elt_at_index              _bfd_noarchive_get_elt_at_index
 #define bfd_mach_o_update_armap_timestamp        _bfd_noarchive_update_armap_timestamp
-#define bfd_mach_o_init_private_section_data     _bfd_generic_init_private_section_data
 
 #define TARGET_NAME_BACKEND XCONCAT2(TARGET_NAME,_backend)
 
index fb5bde17cdb8867e1a7500bbadcbaef670dc4619..cc191b9ef1e4e5e97f02a30e2a2e6194f48e4d34 100644 (file)
@@ -583,15 +583,17 @@ bfd_mach_o_bfd_copy_private_symbol_data (bfd *ibfd ATTRIBUTE_UNUSED,
 
 bool
 bfd_mach_o_bfd_copy_private_section_data (bfd *ibfd, asection *isection,
-                                         bfd *obfd, asection *osection)
+                                         bfd *obfd, asection *osection,
+                                         struct bfd_link_info *link_info)
 {
-  bfd_mach_o_section *os = bfd_mach_o_get_mach_o_section (osection);
-  bfd_mach_o_section *is = bfd_mach_o_get_mach_o_section (isection);
-
-  if (ibfd->xvec->flavour != bfd_target_mach_o_flavour
+  if (link_info != NULL
+      || ibfd->xvec->flavour != bfd_target_mach_o_flavour
       || obfd->xvec->flavour != bfd_target_mach_o_flavour)
     return true;
 
+  bfd_mach_o_section *os = bfd_mach_o_get_mach_o_section (osection);
+  bfd_mach_o_section *is = bfd_mach_o_get_mach_o_section (isection);
+
   BFD_ASSERT (is != NULL && os != NULL);
 
   os->flags = is->flags;
index 3aaae380f2f3adb4998dc235df3ed92295824e17..1cda07226e5c806763f2793c0cc89b2c7f99a432 100644 (file)
@@ -691,7 +691,8 @@ bool bfd_mach_o_write_contents (bfd *);
 bool bfd_mach_o_bfd_copy_private_symbol_data (bfd *, asymbol *,
                                              bfd *, asymbol *);
 bool bfd_mach_o_bfd_copy_private_section_data (bfd *, asection *,
-                                              bfd *, asection *);
+                                              bfd *, asection *,
+                                              struct bfd_link_info *);
 bool bfd_mach_o_bfd_copy_private_header_data (bfd *, bfd *);
 bool bfd_mach_o_bfd_set_private_flags (bfd *, flagword);
 bool bfd_mach_o_bfd_print_private_bfd_data (bfd *, void *);
index 1b1eb87df8f1e27170243a124791d5843174e95d..762aeffd3e0db7a9045be58127a08d24cf5e7dd8 100644 (file)
--- a/bfd/mmo.c
+++ b/bfd/mmo.c
@@ -3350,7 +3350,6 @@ mmo_write_object_contents (bfd *abfd)
 #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_init_private_section_data _bfd_generic_init_private_section_data
 
 const bfd_target mmix_mmo_vec =
 {
index 19f38a4ac1b1b931d82d6816237be61ac4c5f2b5..c337fc5b28205336dc4b733b2190a2ab1999e789 100644 (file)
@@ -3115,9 +3115,11 @@ bool
 _bfd_XX_bfd_copy_private_section_data (bfd *ibfd,
                                       asection *isec,
                                       bfd *obfd,
-                                      asection *osec)
+                                      asection *osec,
+                                      struct bfd_link_info *link_info)
 {
-  if (bfd_get_flavour (ibfd) != bfd_target_coff_flavour
+  if (link_info != NULL
+      || bfd_get_flavour (ibfd) != bfd_target_coff_flavour
       || bfd_get_flavour (obfd) != bfd_target_coff_flavour)
     return true;
 
index d57ae593e783a4dfb5f9ab9214085d552e6ad906..1c72b748a8fa639348aa665dbb3b0995d53a4d05 100644 (file)
@@ -73,8 +73,6 @@ dlerror (void)
 #define bfd_plugin_bfd_free_cached_info                      _bfd_generic_bfd_free_cached_info
 #define bfd_plugin_new_section_hook                  _bfd_generic_new_section_hook
 #define bfd_plugin_get_section_contents                      _bfd_generic_get_section_contents
-#define bfd_plugin_init_private_section_data         _bfd_generic_init_private_section_data
-#define bfd_plugin_bfd_copy_private_header_data              _bfd_generic_bfd_copy_private_header_data
 #define bfd_plugin_bfd_merge_private_bfd_data        _bfd_generic_bfd_merge_private_bfd_data
 #define bfd_plugin_bfd_copy_private_header_data              _bfd_generic_bfd_copy_private_header_data
 #define bfd_plugin_bfd_set_private_flags             _bfd_generic_bfd_set_private_flags
@@ -782,7 +780,8 @@ static bool
 bfd_plugin_bfd_copy_private_section_data (bfd *ibfd ATTRIBUTE_UNUSED,
                                          asection *isection ATTRIBUTE_UNUSED,
                                          bfd *obfd ATTRIBUTE_UNUSED,
-                                         asection *osection ATTRIBUTE_UNUSED)
+                                         asection *osection ATTRIBUTE_UNUSED,
+                                         struct bfd_link_info *link_info ATTRIBUTE_UNUSED)
 {
   BFD_ASSERT (0);
   return true;
index b4b59c94d2f0333f9c7feb276c09a271e98483ed..dd70267640c4ecdc22347f75a8702d58cd00b7af 100644 (file)
@@ -474,7 +474,6 @@ ppcboot_bfd_print_private_bfd_data (bfd *abfd, void * farg)
 
 #define ppcboot_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
 #define ppcboot_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
-#define ppcboot_init_private_section_data _bfd_generic_init_private_section_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
index 9460ff916b93f902960a031fb22070c93a02fb23..5f0cf6e71cb4fe61f9ecf1a23977143442a8a049 100644 (file)
@@ -1667,7 +1667,8 @@ FUNCTION
 
 SYNOPSIS
        bool bfd_copy_private_section_data
-         (bfd *ibfd, asection *isec, bfd *obfd, asection *osec);
+         (bfd *ibfd, asection *isec, bfd *obfd, asection *osec,
+          struct bfd_link_info *link_info);
 
 DESCRIPTION
        Copy private section information from @var{isec} in the BFD
@@ -1678,9 +1679,9 @@ DESCRIPTION
        o <<bfd_error_no_memory>> -
        Not enough memory exists to create private data for @var{osec}.
 
-.#define bfd_copy_private_section_data(ibfd, isection, obfd, osection) \
+.#define bfd_copy_private_section_data(ibfd, isec, obfd, osec, link_info) \
 .      BFD_SEND (obfd, _bfd_copy_private_section_data, \
-.                (ibfd, isection, obfd, osection))
+.                (ibfd, isec, obfd, osec, link_info))
 */
 
 /*
index d3e0876efb1491d30404605c78882045ada92eea..5c60f605043cc43e2538b269b7939c43e0d604cd 100644 (file)
--- a/bfd/som.c
+++ b/bfd/som.c
@@ -5372,17 +5372,17 @@ static bool
 som_bfd_copy_private_section_data (bfd *ibfd,
                                   asection *isection,
                                   bfd *obfd,
-                                  asection *osection)
+                                  asection *osection,
+                                  struct bfd_link_info *link_info)
 {
-  size_t amt;
-
   /* One day we may try to grok other private data.  */
-  if (ibfd->xvec->flavour != bfd_target_som_flavour
+  if (link_info != NULL
+      || ibfd->xvec->flavour != bfd_target_som_flavour
       || obfd->xvec->flavour != bfd_target_som_flavour
       || (!som_is_space (isection) && !som_is_subspace (isection)))
     return true;
 
-  amt = sizeof (struct som_copyable_section_data_struct);
+  size_t amt = sizeof (struct som_copyable_section_data_struct);
   som_section_data (osection)->copy_data = bfd_zalloc (obfd, amt);
   if (som_section_data (osection)->copy_data == NULL)
     return false;
@@ -5401,7 +5401,8 @@ som_bfd_copy_private_section_data (bfd *ibfd,
        {
          /* User has specified a subspace without its containing space.  */
          _bfd_error_handler (_("%pB[%pA]: no output section for space %pA"),
-           obfd, osection, som_section_data (osection)->copy_data->container);
+                             obfd, osection,
+                             som_section_data (osection)->copy_data->container);
          return false;
        }
     }
@@ -6779,7 +6780,6 @@ som_bfd_link_split_section (bfd *abfd ATTRIBUTE_UNUSED, asection *sec)
 #define som_bfd_link_hide_symbol               _bfd_generic_link_hide_symbol
 #define som_bfd_define_start_stop              bfd_generic_define_start_stop
 #define som_bfd_merge_private_bfd_data         _bfd_generic_bfd_merge_private_bfd_data
-#define som_init_private_section_data          _bfd_generic_init_private_section_data
 #define som_bfd_copy_private_header_data       _bfd_generic_bfd_copy_private_header_data
 #define som_bfd_set_private_flags              _bfd_generic_bfd_set_private_flags
 #define som_find_inliner_info                  _bfd_nosymbols_find_inliner_info
index 18f5782daf773fb5e484e747554f7118cb34e12c..23333701ec07305e5bd18deb1e1bdac879398f1e 100644 (file)
@@ -282,7 +282,6 @@ BFD_JUMP_TABLE macros.
 .#define BFD_JUMP_TABLE_COPY(NAME) \
 .  NAME##_bfd_copy_private_bfd_data, \
 .  NAME##_bfd_merge_private_bfd_data, \
-.  NAME##_init_private_section_data, \
 .  NAME##_bfd_copy_private_section_data, \
 .  NAME##_bfd_copy_private_symbol_data, \
 .  NAME##_bfd_copy_private_header_data, \
@@ -295,16 +294,10 @@ BFD_JUMP_TABLE macros.
 .  {* Called to merge BFD general private data from one object file
 .     to a common output file when linking.  *}
 .  bool (*_bfd_merge_private_bfd_data) (bfd *, struct bfd_link_info *);
-.  {* Called to initialize BFD private section data from one object file
-.     to another.  *}
-.#define bfd_init_private_section_data(ibfd, isec, obfd, osec, link_info) \
-.      BFD_SEND (obfd, _bfd_init_private_section_data, \
-.                (ibfd, isec, obfd, osec, link_info))
-.  bool (*_bfd_init_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
-.                                         struct bfd_link_info *);
 .  {* Called to copy BFD private section data from one object file
 .     to another.  *}
-.  bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr);
+.  bool (*_bfd_copy_private_section_data) (bfd *, sec_ptr, bfd *, sec_ptr,
+.                                         struct bfd_link_info *);
 .  {* Called to copy BFD private symbol data from one symbol
 .     to another.  *}
 .  bool (*_bfd_copy_private_symbol_data) (bfd *, asymbol *,
index 548a97901003069457f90d21ec310c877fe6cf91..c4b248494ee624f7b1d6acbf45065469cda7c682 100644 (file)
@@ -10156,7 +10156,6 @@ bfd_vms_get_data (bfd *abfd)
 
 #define vms_bfd_copy_private_bfd_data    _bfd_generic_bfd_copy_private_bfd_data
 #define vms_bfd_merge_private_bfd_data   _bfd_generic_bfd_merge_private_bfd_data
-#define vms_init_private_section_data    _bfd_generic_init_private_section_data
 #define vms_bfd_copy_private_section_data _bfd_generic_bfd_copy_private_section_data
 #define vms_bfd_copy_private_symbol_data  _bfd_generic_bfd_copy_private_symbol_data
 #define vms_bfd_copy_private_header_data  _bfd_generic_bfd_copy_private_header_data
index 2e98ba44c019f61f889eb7179116543eb97c6385..8c9077356f19f09243894359fac08da896ef0555 100644 (file)
@@ -4398,7 +4398,7 @@ setup_section (bfd *ibfd, sec_ptr isection, bfd *obfd)
 
   /* Allow the BFD backend to copy any private data it understands
      from the input section to the output section.  */
-  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
+  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL))
     err = _("failed to copy private data");
 
   if (make_nobits)
index 32e6e7abdf17eec587b2fc9cf64bb6f8cd5653cb..cd1825b1bc0b91d3f5c7ac2fc10a3b47bf7b17ab 100644 (file)
@@ -2874,7 +2874,7 @@ lang_add_section (lang_statement_list_type *ptr,
       /* This must happen after flags have been updated.  The output
         section may have been created before we saw its first input
         section, eg. for a data statement.  */
-      bfd_init_private_section_data (section->owner, section,
+      bfd_copy_private_section_data (section->owner, section,
                                     link_info.output_bfd,
                                     output->bfd_section,
                                     &link_info);
@@ -10494,7 +10494,7 @@ setup_section (bfd *ibfd, sec_ptr isection, void *p)
 
   /* Allow the BFD backend to copy any private data it understands
      from the input section to the output section.  */
-  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection))
+  if (!bfd_copy_private_section_data (ibfd, isection, obfd, osection, NULL))
     {
       err = _("failed to copy private data");
       goto loser;
index 7613def6767084fb70bc16ecd839392877684a20..974245f602edfd4022275199fd0aae13ad442672 100644 (file)
@@ -366,7 +366,7 @@ clone_section (bfd *abfd, asection *s, const char *name, int *count)
   n->reloc_count = 0;
   n->alignment_power = s->alignment_power;
 
-  bfd_copy_private_section_data (abfd, s, abfd, n);
+  bfd_copy_private_section_data (abfd, s, abfd, n, NULL);
 
   return n;
 }