* elfcode.h (elf_set_section_contents): Support calling the backend
authorJeff Law <law@redhat.com>
Thu, 7 Apr 1994 18:12:25 +0000 (18:12 +0000)
committerJeff Law <law@redhat.com>
Thu, 7 Apr 1994 18:12:25 +0000 (18:12 +0000)
function elf_backend_begin_write_processing when just beginning to
write an object file.

* libelf.h (elf_backend_begin_write_processing): Declare.

* elf{32,64}-target.h (elf_backend_begin_write_processing): Provide
a default definition.
(elf{32,64}_bed): Add elf_backend_begin_write_processing.

* elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration.
(elf_hppa_tc_make_sections): Likewise.

* elf32-hppa.c (symext_chain_built): Delete.
(symext_chain_size): Renamed from symextn_contents_real_size.
(elf32_hppa_backend_{begin,final}_write_processing): New functions.
(add_entry_to_symext_chain): New function.
(hppa_elf_set_section_contents): Ignore writes to the symbol extension
section until it's been rebuilt internally.
(hppa_elf_get_section_contents): Symbol extension section is no
longer special.
(elf_backend_{begin,final}_write_processing): Define.
(elf_hppa_tc_make_sections): Simplify now that much code has
migrated into elf32_hppa_backend_{being,final}_write_processing.

bfd/ChangeLog
bfd/elf32-target.h
bfd/elf64-target.h
bfd/elfcode.h
bfd/libelf.h

index f2f946d7927031f6e34e2a1278bdf045e0ec6d5b..085fc8403d9b2bba0ba5de806475980fde448617 100644 (file)
@@ -1,3 +1,30 @@
+Thu Apr  7 11:10:51 1994  Jeffrey A. Law  (law@snake.cs.utah.edu)
+
+       * elfcode.h (elf_set_section_contents): Support calling the backend
+       function elf_backend_begin_write_processing when just beginning to
+       write an object file.
+
+       * libelf.h (elf_backend_begin_write_processing): Declare.
+
+       * elf{32,64}-target.h (elf_backend_begin_write_processing): Provide
+       a default definition.
+       (elf{32,64}_bed): Add elf_backend_begin_write_processing.
+       
+       * elf32-hppa.h (elf_hppa_tc_symbol): Delete extern declaration.
+       (elf_hppa_tc_make_sections): Likewise.
+
+       * elf32-hppa.c (symext_chain_built): Delete.
+       (symext_chain_size): Renamed from symextn_contents_real_size.
+       (elf32_hppa_backend_{begin,final}_write_processing): New functions.
+       (add_entry_to_symext_chain): New function.
+       (hppa_elf_set_section_contents): Ignore writes to the symbol extension
+       section until it's been rebuilt internally.
+       (hppa_elf_get_section_contents): Symbol extension section is no
+       longer special.
+       (elf_backend_{begin,final}_write_processing): Define.
+       (elf_hppa_tc_make_sections): Simplify now that much code has
+       migrated into elf32_hppa_backend_{being,final}_write_processing.
+
 Wed Apr  6 17:24:14 1994  Ian Lance Taylor  (ian@tweedledumb.cygnus.com)
 
        Add new target vectors to read the dynamic symbols and dynamic
index f5a1fae12c56f8ab4fafd98a07cad411c77a0050..dc0ccf6a701ed2b5d2a294f85c8ee56734db1764 100644 (file)
@@ -91,6 +91,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #ifndef elf_backend_section_from_bfd_section
 #define elf_backend_section_from_bfd_section   0
 #endif
+#ifndef elf_backend_begin_write_processing
+#define elf_backend_begin_write_processing     0
+#endif
 #ifndef elf_backend_final_write_processing
 #define elf_backend_final_write_processing     0
 #endif
@@ -119,6 +122,7 @@ static CONST struct elf_backend_data elf32_bed =
   elf_backend_section_from_shdr,
   elf_backend_fake_sections,
   elf_backend_section_from_bfd_section,
+  elf_backend_begin_write_processing,
   elf_backend_final_write_processing,
   elf_backend_ecoff_debug_swap
 };
index e32f11465e32f28bc96e768908dda0192edff277..31940738639adba27f138a1d620c11c8c3ca6502 100644 (file)
@@ -94,6 +94,9 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #ifndef elf_backend_section_from_bfd_section
 #define elf_backend_section_from_bfd_section   0
 #endif
+#ifndef elf_backend_begin_write_processing
+#define elf_backend_begin_write_processing     0
+#endif
 #ifndef elf_backend_final_write_processing
 #define elf_backend_final_write_processing     0
 #endif
@@ -122,6 +125,8 @@ static CONST struct elf_backend_data elf64_bed =
   elf_backend_section_from_shdr,
   elf_backend_fake_sections,
   elf_backend_section_from_bfd_section,
+  elf_backend_begin_write_processing,
+  elf_backend_final_write_processing,
   elf_backend_ecoff_debug_swap
 };
 
index 8a54d4bf07900944f781f4e981ed13da5dee7a17..5fd42992092377f7b8df20927b16087df260adaa 100644 (file)
@@ -2374,6 +2374,10 @@ NAME(bfd_elf,write_object_contents) (abfd)
 
   if (abfd->output_has_begun == false)
     {
+      /* Do any elf backend specific processing first.  */
+      if (bed->elf_backend_begin_write_processing)
+       (*bed->elf_backend_begin_write_processing) (abfd);
+
       if (prep_headers (abfd) == false)
        return false;
       if (elf_compute_section_file_positions (abfd) == false)
@@ -3233,6 +3237,12 @@ elf_set_section_contents (abfd, section, location, offset, count)
 
   if (abfd->output_has_begun == false) /* set by bfd.c handler? */
     {
+      struct elf_backend_data *bed = get_elf_backend_data (abfd);
+
+      /* Do any elf backend specific processing first.  */
+      if (bed->elf_backend_begin_write_processing)
+       (*bed->elf_backend_begin_write_processing) (abfd);
+
       /* do setup calculations (FIXME) */
       if (prep_headers (abfd) == false)
        return false;
index 9eb93ec0d9ab3ffad7b91be6aac4d8cbae517d3f..ce22cc12089861053c76f6af33e584a0ee29878b 100644 (file)
@@ -149,6 +149,10 @@ struct elf_backend_data
   boolean (*elf_backend_section_from_bfd_section)
     PARAMS ((bfd *, Elf32_Internal_Shdr *, asection *, int *retval));
 
+  /* A function to do any beginning processing needed for the ELF file
+     before building the ELF headers and computing file positions.  */
+  void (*elf_backend_begin_write_processing) PARAMS ((bfd *));
+
   /* A function to do any final processing needed for the ELF file
      before writing it out.  */
   void (*elf_backend_final_write_processing) PARAMS ((bfd *));