Rewrite __start and __stop symbol handling
[deliverable/binutils-gdb.git] / bfd / targets.c
index bfb34f1124af7de90e5927337ae8ddf2b910f9d6..05224c4fa71a6d4d4750d57041bd89efe69faafb 100644 (file)
@@ -1,5 +1,5 @@
 /* Generic target-file-type support for the BFD library.
-   Copyright (C) 1990-2015 Free Software Foundation, Inc.
+   Copyright (C) 1990-2017 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -291,7 +291,7 @@ BFD_JUMP_TABLE macros.
 .  bfd_boolean (*_bfd_copy_private_bfd_data) (bfd *, bfd *);
 .  {* Called to merge BFD general private data from one object file
 .     to a common output file when linking.  *}
-.  bfd_boolean (*_bfd_merge_private_bfd_data) (bfd *, bfd *);
+.  bfd_boolean (*_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) \
@@ -418,12 +418,15 @@ BFD_JUMP_TABLE macros.
 .#define BFD_JUMP_TABLE_RELOCS(NAME) \
 .  NAME##_get_reloc_upper_bound, \
 .  NAME##_canonicalize_reloc, \
+.  NAME##_set_reloc, \
 .  NAME##_bfd_reloc_type_lookup, \
 .  NAME##_bfd_reloc_name_lookup
 .
 .  long        (*_get_reloc_upper_bound) (bfd *, sec_ptr);
 .  long        (*_bfd_canonicalize_reloc)
 .    (bfd *, sec_ptr, arelent **, struct bfd_symbol **);
+.  void               (*_bfd_set_reloc)
+.    (bfd *, sec_ptr, arelent **, unsigned int);
 .  {* See documentation on reloc types.  *}
 .  reloc_howto_type *
 .              (*reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
@@ -452,13 +455,15 @@ BFD_JUMP_TABLE macros.
 .  NAME##_bfd_copy_link_hash_symbol_type, \
 .  NAME##_bfd_final_link, \
 .  NAME##_bfd_link_split_section, \
+.  NAME##_bfd_link_check_relocs, \
 .  NAME##_bfd_gc_sections, \
 .  NAME##_bfd_lookup_section_flags, \
 .  NAME##_bfd_merge_sections, \
 .  NAME##_bfd_is_group_section, \
 .  NAME##_bfd_discard_group, \
 .  NAME##_section_already_linked, \
-.  NAME##_bfd_define_common_symbol
+.  NAME##_bfd_define_common_symbol, \
+.  NAME##_bfd_define_start_stop
 .
 .  int         (*_bfd_sizeof_headers) (bfd *, struct bfd_link_info *);
 .  bfd_byte *  (*_bfd_get_relocated_section_contents)
@@ -493,6 +498,9 @@ BFD_JUMP_TABLE macros.
 .  {* Should this section be split up into smaller pieces during linking.  *}
 .  bfd_boolean (*_bfd_link_split_section) (bfd *, struct bfd_section *);
 .
+.  {* Check the relocations in the bfd for validity.  *}
+.  bfd_boolean (* _bfd_link_check_relocs)(bfd *, struct bfd_link_info *);
+.
 .  {* Remove sections that are not referenced from the output.  *}
 .  bfd_boolean (*_bfd_gc_sections) (bfd *, struct bfd_link_info *);
 .
@@ -519,6 +527,11 @@ BFD_JUMP_TABLE macros.
 .  bfd_boolean (*_bfd_define_common_symbol) (bfd *, struct bfd_link_info *,
 .                                           struct bfd_link_hash_entry *);
 .
+.  {* Define a __start, __stop, .startof. or .sizeof. symbol.  *}
+.  struct bfd_link_hash_entry *(*_bfd_define_start_stop) (struct bfd_link_info *,
+.                                                        const char *,
+.                                                        asection *);
+.
 .  {* Routines to handle dynamic symbols and relocs.  *}
 .#define BFD_JUMP_TABLE_DYNAMIC(NAME) \
 .  NAME##_get_dynamic_symtab_upper_bound, \
@@ -795,6 +808,9 @@ extern const bfd_target powerpc_pe_le_vec;
 extern const bfd_target powerpc_pei_vec;
 extern const bfd_target powerpc_pei_le_vec;
 extern const bfd_target powerpc_xcoff_vec;
+extern const bfd_target pru_elf32_vec;
+extern const bfd_target riscv_elf32_vec;
+extern const bfd_target riscv_elf64_vec;
 extern const bfd_target rl78_elf32_vec;
 extern const bfd_target rs6000_xcoff64_vec;
 extern const bfd_target rs6000_xcoff64_aix_vec;
@@ -886,6 +902,8 @@ extern const bfd_target vax_aout_nbsd_vec;
 extern const bfd_target vax_elf32_vec;
 extern const bfd_target visium_elf32_vec;
 extern const bfd_target w65_coff_vec;
+extern const bfd_target wasm_vec;
+extern const bfd_target wasm32_elf32_vec;
 extern const bfd_target we32k_coff_vec;
 extern const bfd_target x86_64_coff_vec;
 extern const bfd_target x86_64_elf32_vec;
@@ -1299,6 +1317,12 @@ static const bfd_target * const _bfd_target_vector[] =
        &powerpc_xcoff_vec,
 #endif
 
+       &pru_elf32_vec,
+
+#ifdef BFD64
+       &riscv_elf32_vec,
+       &riscv_elf64_vec,
+#endif
        &rl78_elf32_vec,
 
 #ifdef BFD64
@@ -1408,6 +1432,9 @@ static const bfd_target * const _bfd_target_vector[] =
 
        &w65_coff_vec,
 
+        &wasm_vec,
+        &wasm32_elf32_vec,
+
        &we32k_coff_vec,
 
 #ifdef BFD64
@@ -1811,29 +1838,28 @@ bfd_target_list (void)
 
 /*
 FUNCTION
-       bfd_seach_for_target
+       bfd_iterate_over_targets
 
 SYNOPSIS
-       const bfd_target *bfd_search_for_target
-         (int (*search_func) (const bfd_target *, void *),
-          void *);
+       const bfd_target *bfd_iterate_over_targets
+         (int (*func) (const bfd_target *, void *),
+          void *data);
 
 DESCRIPTION
-       Return a pointer to the first transfer vector in the list of
-       transfer vectors maintained by BFD that produces a non-zero
-       result when passed to the function @var{search_func}.  The
-       parameter @var{data} is passed, unexamined, to the search
-       function.
+       Call @var{func} for each target in the list of BFD target
+       vectors, passing @var{data} to @var{func}.  Stop iterating if
+       @var{func} returns a non-zero result, and return that target
+       vector.  Return NULL if @var{func} always returns zero.
 */
 
 const bfd_target *
-bfd_search_for_target (int (*search_func) (const bfd_target *, void *),
-                      void *data)
+bfd_iterate_over_targets (int (*func) (const bfd_target *, void *),
+                         void *data)
 {
-  const bfd_target * const *target;
+  const bfd_target *const *target;
 
-  for (target = bfd_target_vector; *target != NULL; target ++)
-    if (search_func (*target, data))
+  for (target = bfd_target_vector; *target != NULL; ++target)
+    if (func (*target, data))
       return *target;
 
   return NULL;
This page took 0.02646 seconds and 4 git commands to generate.