gdb: add target_ops::supports_displaced_step
[deliverable/binutils-gdb.git] / bfd / elf-bfd.h
index 820bc982af36e7afef5c63258cab3512c5766ee9..fbdd19ba21e35fbbe15da230c3ad5ce7ecb94b6d 100644 (file)
@@ -1,5 +1,5 @@
 /* BFD back-end data structures for ELF files.
-   Copyright (C) 1992-2017 Free Software Foundation, Inc.
+   Copyright (C) 1992-2020 Free Software Foundation, Inc.
    Written by Cygnus Support.
 
    This file is part of BFD, the Binary File Descriptor library.
@@ -156,9 +156,13 @@ struct elf_link_hash_entry
   /* Same, but tracks a procedure linkage table entry.  */
   union gotplt_union plt;
 
-  /* Symbol size.  */
+  /* Symbol size.  NB: All fields starting from here are cleared by
+    _bfd_elf_link_hash_newfunc.  */
   bfd_size_type size;
 
+  /* Track dynamic relocs copied for this symbol.  */
+  struct elf_dyn_relocs *dyn_relocs;
+
   /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */
   unsigned int type : 8;
 
@@ -213,20 +217,25 @@ struct elf_link_hash_entry
   /* Symbol is defined by a shared library with non-default visibility
      in a read/write section.  */
   unsigned int protected_def : 1;
+  /* Symbol is __start_SECNAME or __stop_SECNAME to mark section
+     SECNAME.  */
+  unsigned int start_stop : 1;
+  /* Symbol is or was a weak defined symbol from a dynamic object with
+     a strong defined symbol alias.  U.ALIAS points to a list of aliases,
+     the definition having is_weakalias clear.  */
+  unsigned int is_weakalias : 1;
 
   /* String table index in .dynstr if this is a dynamic symbol.  */
   unsigned long dynstr_index;
 
   union
   {
-    /* If this is a weak defined symbol from a dynamic object, this
-       field points to a defined symbol with the same value, if there is
-       one.  Otherwise it is NULL.  */
-    struct elf_link_hash_entry *weakdef;
+    /* Points to a circular list of non-function symbol aliases.  */
+    struct elf_link_hash_entry *alias;
 
     /* Hash value of the name computed using the ELF hash function.
        Used part way through size_dynamic_sections, after we've finished
-       with weakdefs.  */
+       with aliases.  */
     unsigned long elf_hash_value;
   } u;
 
@@ -243,9 +252,27 @@ struct elf_link_hash_entry
     struct bfd_elf_version_tree *vertree;
   } verinfo;
 
-  struct elf_link_virtual_table_entry *vtable;
+  union
+  {
+    /* For __start_SECNAME and __stop_SECNAME symbols, record the first
+       input section whose section name is SECNAME.  */
+    asection *start_stop_section;
+
+    /* Vtable information. */
+    struct elf_link_virtual_table_entry *vtable;
+  } u2;
 };
 
+/* Return the strong definition for a weak symbol with aliases.  */
+
+static inline struct elf_link_hash_entry *
+weakdef (struct elf_link_hash_entry *h)
+{
+  while (h->is_weakalias)
+    h = h->u.alias;
+  return h;
+}
+
 /* Will references to this symbol always reference the symbol
    in this object?  */
 #define SYMBOL_REFERENCES_LOCAL(INFO, H) \
@@ -255,6 +282,13 @@ struct elf_link_hash_entry
 #define SYMBOL_CALLS_LOCAL(INFO, H) \
   _bfd_elf_symbol_refs_local_p (H, INFO, 1)
 
+/* Whether an undefined weak symbol should resolve to its link-time
+   value, even in PIC or PIE objects.  */
+#define UNDEFWEAK_NO_DYNAMIC_RELOC(INFO, H)            \
+  ((H)->root.type == bfd_link_hash_undefweak           \
+   && (ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT   \
+       || (INFO)->dynamic_undefined_weak == 0))
+
 /* Common symbols that are turned into definitions don't have the
    DEF_REGULAR flag set, so they might appear to be undefined.
    Symbols defined in linker scripts also don't have DEF_REGULAR set.  */
@@ -318,8 +352,8 @@ struct eh_cie_fde
           .eh_frame input section that contains the CIE.  */
       union {
        struct cie *full_cie;
-       struct eh_cie_fde *merged_with;
-       asection *sec;
+       struct eh_cie_fde *merged_with;
+       asection *sec;
       } u;
 
       /* The offset of the personality data from the start of the CIE,
@@ -459,6 +493,7 @@ enum elf_target_id
   AVR_ELF_DATA,
   BFIN_ELF_DATA,
   CRIS_ELF_DATA,
+  CSKY_ELF_DATA,
   FRV_ELF_DATA,
   HPPA32_ELF_DATA,
   HPPA64_ELF_DATA,
@@ -485,7 +520,6 @@ enum elf_target_id
   TIC6X_ELF_DATA,
   X86_64_ELF_DATA,
   XTENSA_ELF_DATA,
-  XGATE_ELF_DATA,
   TILEGX_ELF_DATA,
   TILEPRO_ELF_DATA,
   RISCV_ELF_DATA,
@@ -499,6 +533,13 @@ struct elf_sym_strtab
   unsigned long destshndx_index;
 };
 
+struct bfd_link_needed_list
+{
+  struct bfd_link_needed_list *next;
+  bfd *by;
+  const char *name;
+};
+
 /* ELF linker hash table.  */
 
 struct elf_link_hash_table
@@ -513,6 +554,9 @@ struct elf_link_hash_table
      when linking against or generating a shared object.  */
   bfd_boolean dynamic_sections_created;
 
+  /* Whether dynamic relocations are present.  */
+  bfd_boolean dynamic_relocs;
+
   /* True if this target has relocatable executables, so needs dynamic
      section symbols.  */
   bfd_boolean is_relocatable_executable;
@@ -595,10 +639,10 @@ struct elf_link_hash_table
 
   /* Cached first output tls section and size of PT_TLS segment.  */
   asection *tls_sec;
-  bfd_size_type tls_size;
+  bfd_size_type tls_size;  /* Bytes.  */
 
-  /* A linked list of BFD's loaded in the link.  */
-  struct elf_link_loaded_list *loaded;
+  /* A linked list of dynamic BFD's loaded in the link.  */
+  struct elf_link_loaded_list *dyn_loaded;
 
   /* Short-cuts to get to dynamic linker sections.  */
   asection *sgot;
@@ -639,7 +683,7 @@ struct elf_link_hash_table
 #define elf_hash_table_id(table)       ((table) -> hash_table_id)
 
 /* Returns TRUE if the hash table is a struct elf_link_hash_table.  */
-#define is_elf_hash_table(htab)                                                \
+#define is_elf_hash_table(htab)                                                \
   (((struct bfd_link_hash_table *) (htab))->type == bfd_link_elf_hash_table)
 
 /* Used by bfd_sym_from_r_symndx to cache a small number of local
@@ -713,10 +757,11 @@ struct elf_size_info {
 };
 
 #define elf_symbol_from(ABFD,S) \
-       (((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \
-         && (S)->the_bfd->tdata.elf_obj_data != 0) \
-        ? (elf_symbol_type *) (S) \
-        : 0)
+  (((S)->the_bfd != NULL                                       \
+    && (S)->the_bfd->xvec->flavour == bfd_target_elf_flavour   \
+    && (S)->the_bfd->tdata.elf_obj_data != 0)                  \
+   ? (elf_symbol_type *) (S)                                   \
+   : 0)
 
 enum elf_reloc_type_class {
   reloc_class_normal,
@@ -833,6 +878,9 @@ struct elf_backend_data
   /* The common page size for this backend.  */
   bfd_vma commonpagesize;
 
+  /* The value of commonpagesize to use when -z relro for this backend.  */
+  bfd_vma relropagesize;
+
   /* The BFD flags applied to sections created for dynamic linking.  */
   flagword dynamic_sec_flags;
 
@@ -841,13 +889,13 @@ struct elf_backend_data
   const void *arch_data;
 
   /* A function to translate an ELF RELA relocation to a BFD arelent
-     structure.  */
-  void (*elf_info_to_howto)
+     structure.  Returns TRUE upon success, FALSE otherwise.  */
+  bfd_boolean (*elf_info_to_howto)
     (bfd *, arelent *, Elf_Internal_Rela *);
 
   /* A function to translate an ELF REL relocation to a BFD arelent
-     structure.  */
-  void (*elf_info_to_howto_rel)
+     structure.  Returns TRUE upon success, FALSE otherwise.  */
+  bfd_boolean (*elf_info_to_howto_rel)
     (bfd *, arelent *, Elf_Internal_Rela *);
 
   /* A function to determine whether a symbol is global when
@@ -911,7 +959,7 @@ struct elf_backend_data
   /* A function to convert machine dependent ELF section header flags to
      BFD internal section header flags.  */
   bfd_boolean (*elf_backend_section_flags)
-    (flagword *, const Elf_Internal_Shdr *);
+    (const Elf_Internal_Shdr *);
 
   /* A function that returns a struct containing ELF section flags and
      type for the given BFD section.   */
@@ -1039,6 +1087,12 @@ struct elf_backend_data
   bfd_boolean (*elf_backend_size_dynamic_sections)
     (bfd *output_bfd, struct bfd_link_info *info);
 
+  /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the
+     ELF backend linker to strip zero-sized dynamic sections after
+     the section sizes have been set.  */
+  bfd_boolean (*elf_backend_strip_zero_sized_dynamic_sections)
+    (struct bfd_link_info *info);
+
   /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections
      we keep to use as a base for relocs and symbols.  */
   void (*elf_backend_init_index_section)
@@ -1104,10 +1158,9 @@ struct elf_backend_data
     (bfd *, struct bfd_link_info *);
 
   /* A function to do any final processing needed for the ELF file
-     before writing it out.  The LINKER argument is TRUE if this BFD
-     was created by the ELF backend linker.  */
-  void (*elf_backend_final_write_processing)
-    (bfd *, bfd_boolean linker);
+     before writing it out.  */
+  bfd_boolean (*elf_backend_final_write_processing)
+    (bfd *);
 
   /* This function is called by get_program_header_size.  It should
      return the number of additional program segments which this BFD
@@ -1122,7 +1175,7 @@ struct elf_backend_data
 
   /* This function is called to modify program headers just before
      they are written.  */
-  bfd_boolean (*elf_backend_modify_program_headers)
+  bfd_boolean (*elf_backend_modify_headers)
     (bfd *, struct bfd_link_info *);
 
   /* This function is called to see if the PHDR header should be
@@ -1149,16 +1202,9 @@ struct elf_backend_data
   bfd_boolean (*gc_mark_extra_sections)
     (struct bfd_link_info *, elf_gc_mark_hook_fn);
 
-  /* This function, if defined, is called during the sweep phase of gc
-     in order that a backend might update any data structures it might
-     be maintaining.  */
-  bfd_boolean (*gc_sweep_hook)
-    (bfd *, struct bfd_link_info *, asection *, const Elf_Internal_Rela *);
-
-  /* This function, if defined, is called after the ELF headers have
-     been created.  This allows for things like the OS and ABI versions
-     to be changed.  */
-  void (*elf_backend_post_process_headers)
+  /* This function is called to initialise ELF file header info.
+     Customised versions can modify things like the OS and ABI version.  */
+  bfd_boolean (*elf_backend_init_file_header)
     (bfd *, struct bfd_link_info *);
 
   /* This function, if defined, prints a symbol to file and returns the
@@ -1259,6 +1305,11 @@ struct elf_backend_data
   bfd_boolean (*elf_backend_grok_psinfo)
     (bfd *, Elf_Internal_Note *);
 
+  /* This function, if defined, is called when a "FreeBSD" NT_PRSTATUS
+     note is found in a core file.  */
+  bfd_boolean (*elf_backend_grok_freebsd_prstatus)
+    (bfd *, Elf_Internal_Note *);
+
   /* This function, if defined, is called to write a note to a corefile.  */
   char *(*elf_backend_write_core_note)
     (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
@@ -1322,7 +1373,7 @@ struct elf_backend_data
     (bfd *);
 
   reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
-    (unsigned int, bfd_boolean);
+    (bfd *, unsigned int, bfd_boolean);
 
   /* The swapping table to use when dealing with ECOFF information.
      Used for the MIPS ELF .mdebug section.  */
@@ -1335,6 +1386,8 @@ struct elf_backend_data
      int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
                                bfd_size_type len));
 
+  bfd_boolean (*elf_backend_core_find_build_id) (bfd *, bfd_vma);
+
   /* This function is used by `_bfd_elf_get_synthetic_symtab';
      see elf.c.  */
   bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
@@ -1357,6 +1410,13 @@ struct elf_backend_data
   /* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
   bfd_boolean (*elf_hash_symbol) (struct elf_link_hash_entry *);
 
+  /* If non-NULL, called to register the location of XLAT_LOC within
+     .MIPS.xhash at which real final dynindx for H will be written.
+     If XLAT_LOC is zero, the symbol is not included in
+     .MIPS.xhash and no dynindx will be written.  */
+  void (*record_xhash_symbol)
+    (struct elf_link_hash_entry *h, bfd_vma xlat_loc);
+
   /* Return TRUE if type is a function symbol type.  */
   bfd_boolean (*is_function_type) (unsigned int type);
 
@@ -1380,7 +1440,7 @@ struct elf_backend_data
   bfd_boolean (*elf_backend_copy_special_section_fields)
     (const bfd *ibfd, bfd *obfd, const Elf_Internal_Shdr *isection,
      Elf_Internal_Shdr *osection);
-               
+
   /* Used to handle bad SHF_LINK_ORDER input.  */
   void (*link_order_error_handler) (const char *, ...);
 
@@ -1437,18 +1497,38 @@ struct elf_backend_data
                                                  unsigned int);
 
   /* Merge GNU properties.  Return TRUE if property is updated.  */
-  bfd_boolean (*merge_gnu_properties) (bfd *, elf_property *,
-                                      elf_property *);
+  bfd_boolean (*merge_gnu_properties) (struct bfd_link_info *, bfd *, bfd *,
+                                      elf_property *, elf_property *);
 
   /* Set up GNU properties.  */
   bfd *(*setup_gnu_properties) (struct bfd_link_info *);
 
+  /* Fix up GNU properties.  */
+  void (*fixup_gnu_properties) (struct bfd_link_info *,
+                               elf_property_list **);
+
   /* Encoding used for compact EH tables.  */
   int (*compact_eh_encoding) (struct bfd_link_info *);
 
   /* Opcode representing no unwind.  */
   int (*cant_unwind_opcode) (struct bfd_link_info *);
 
+  /* Called when emitting an ELF symbol whoes input version had an
+     ST_SHNDX field set to a value in the range SHN_LOPROC..SHN_HIOS.
+     Returns the value to be installed in the ST_SHNDX field of the
+     emitted symbol.  If not defined, the value is left unchanged.  */
+  unsigned int (*symbol_section_index) (bfd *, elf_symbol_type *);
+  
+  /* Called when a section has extra reloc sections.  */
+  bfd_boolean (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *,
+                                              const char *, unsigned int);
+
+  /* Called when after loading the normal relocs for a section.  */
+  bfd_boolean (*slurp_secondary_relocs) (bfd *, asection *, asymbol **);
+
+  /* Called after writing the normal relocs for a section.  */
+  bfd_boolean (*write_secondary_relocs) (bfd *, asection *);
+
   /* This is non-zero if static TLS segments require a special alignment.  */
   unsigned static_tls_alignment;
 
@@ -1541,6 +1621,14 @@ struct elf_backend_data
   /* True if `_bfd_elf_link_renumber_dynsyms' must be called even for
      static binaries.  */
   unsigned always_renumber_dynsyms : 1;
+
+  /* True if the 32-bit Linux PRPSINFO structure's `pr_uid' and `pr_gid'
+     members use a 16-bit data type.  */
+  unsigned linux_prpsinfo32_ugid16 : 1;
+
+  /* True if the 64-bit Linux PRPSINFO structure's `pr_uid' and `pr_gid'
+     members use a 16-bit data type.  */
+  unsigned linux_prpsinfo64_ugid16 : 1;
 };
 
 /* Information about reloc sections associated with a bfd_elf_section_data
@@ -1630,6 +1718,7 @@ struct bfd_elf_section_data
 #define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to)
 #define elf_section_type(sec)  (elf_section_data(sec)->this_hdr.sh_type)
 #define elf_section_flags(sec) (elf_section_data(sec)->this_hdr.sh_flags)
+#define elf_section_info(sec)  (elf_section_data(sec)->this_hdr.sh_info)
 #define elf_group_name(sec)    (elf_section_data(sec)->group.name)
 #define elf_group_id(sec)      (elf_section_data(sec)->group.id)
 #define elf_next_in_group(sec) (elf_section_data(sec)->next_in_group)
@@ -1654,17 +1743,20 @@ struct bfd_elf_section_data
 
 /* The value of an object attribute.  The type indicates whether the attribute
    holds and integer, a string, or both.  It can also indicate that there can
-   be no default (i.e. all values must be written to file, even zero).  */
+   be no default (i.e. all values must be written to file, even zero), or
+   that the value is in error and should not be written to file.  */
 
 typedef struct obj_attribute
 {
 #define ATTR_TYPE_FLAG_INT_VAL    (1 << 0)
 #define ATTR_TYPE_FLAG_STR_VAL    (1 << 1)
 #define ATTR_TYPE_FLAG_NO_DEFAULT (1 << 2)
+#define ATTR_TYPE_FLAG_ERROR     (1 << 3)
 
 #define ATTR_TYPE_HAS_INT_VAL(TYPE)    ((TYPE) & ATTR_TYPE_FLAG_INT_VAL)
 #define ATTR_TYPE_HAS_STR_VAL(TYPE)    ((TYPE) & ATTR_TYPE_FLAG_STR_VAL)
 #define ATTR_TYPE_HAS_NO_DEFAULT(TYPE) ((TYPE) & ATTR_TYPE_FLAG_NO_DEFAULT)
+#define ATTR_TYPE_HAS_ERROR(TYPE)      ((TYPE) & ATTR_TYPE_FLAG_ERROR)
 
   int type;
   unsigned int i;
@@ -1749,33 +1841,35 @@ struct output_elf_obj_tdata
   /* Segment flags for the PT_GNU_STACK segment.  */
   unsigned int stack_flags;
 
-  /* This is set to TRUE if the object was created by the backend
-     linker.  */
-  bfd_boolean linker;
-
   /* Used to determine if the e_flags field has been initialized */
   bfd_boolean flags_init;
 };
 
-/* Indicate if the bfd contains symbols that have the STT_GNU_IFUNC
-   symbol type or STB_GNU_UNIQUE binding.  Used to set the osabi
-   field in the ELF header structure.  */
-enum elf_gnu_symbols
+/* Indicate if the bfd contains SHF_GNU_MBIND sections or symbols that
+   have the STT_GNU_IFUNC symbol type or STB_GNU_UNIQUE binding.  Used
+   to set the osabi field in the ELF header structure.  */
+enum elf_gnu_osabi
 {
-  elf_gnu_symbol_none = 0,
-  elf_gnu_symbol_any = 1 << 0,
-  elf_gnu_symbol_ifunc = (elf_gnu_symbol_any | 1 << 1),
-  elf_gnu_symbol_unique = (elf_gnu_symbol_any | 1 << 2),
-  elf_gnu_symbol_all = (elf_gnu_symbol_ifunc | elf_gnu_symbol_unique)
+  elf_gnu_osabi_mbind = 1 << 0,
+  elf_gnu_osabi_ifunc = 1 << 1,
+  elf_gnu_osabi_unique = 1 << 2,
 };
 
 typedef struct elf_section_list
 {
-  Elf_Internal_Shdr          hdr;
-  unsigned int               ndx;
+  Elf_Internal_Shdr         hdr;
+  unsigned int              ndx;
   struct elf_section_list *  next;
 } elf_section_list;
 
+enum dynamic_lib_link_class {
+  DYN_NORMAL = 0,
+  DYN_AS_NEEDED = 1,
+  DYN_DT_NEEDED = 2,
+  DYN_NO_ADD_NEEDED = 4,
+  DYN_NO_NEEDED = 8
+};
+
 /* Some private data is stashed away for future use using the tdata pointer
    in the bfd structure.  */
 
@@ -1869,28 +1963,37 @@ struct elf_obj_tdata
   struct sdt_note *sdt_note_head;
 
   Elf_Internal_Shdr **group_sect_ptr;
-  int num_group;
+  unsigned int num_group;
+
+  /* Index into group_sect_ptr, updated by setup_group when finding a
+     section's group.  Used to optimize subsequent group searches.  */
+  unsigned int group_search_offset;
 
   unsigned int symtab_section, dynsymtab_section;
   unsigned int dynversym_section, dynverdef_section, dynverref_section;
 
   /* An identifier used to distinguish different target
      specific extensions to this structure.  */
-  enum elf_target_id object_id;
+  ENUM_BITFIELD (elf_target_id) object_id : 6;
 
   /* Whether a dyanmic object was specified normally on the linker
      command line, or was specified when --as-needed was in effect,
      or was found via a DT_NEEDED entry.  */
-  enum dynamic_lib_link_class dyn_lib_class;
+  ENUM_BITFIELD (dynamic_lib_link_class) dyn_lib_class : 4;
+
+  /* Whether the bfd uses OS specific bits that require ELFOSABI_GNU.  */
+  ENUM_BITFIELD (elf_gnu_osabi) has_gnu_osabi : 3;
+
+  /* Whether if the bfd contains the GNU_PROPERTY_NO_COPY_ON_PROTECTED
+     property.  */
+  unsigned int has_no_copy_on_protected : 1;
 
   /* Irix 5 often screws up the symbol table, sorting local symbols
      after global symbols.  This flag is set if the symbol table in
      this BFD appears to be screwed up.  If it is, we ignore the
      sh_info field in the symbol table header, and always read all the
      symbols.  */
-  bfd_boolean bad_symtab;
-
-  enum elf_gnu_symbols has_gnu_symbols;
+  unsigned int bad_symtab : 1;
 
   /* Information grabbed from an elf core file.  */
   struct core_elf_obj_tdata *core;
@@ -1909,7 +2012,6 @@ struct elf_obj_tdata
 #define elf_seg_map(bfd)       (elf_tdata(bfd) -> o->seg_map)
 #define elf_next_file_pos(bfd) (elf_tdata(bfd) -> o->next_file_pos)
 #define elf_eh_frame_hdr(bfd)  (elf_tdata(bfd) -> o->eh_frame_hdr)
-#define elf_linker(bfd)                (elf_tdata(bfd) -> o->linker)
 #define elf_stack_flags(bfd)   (elf_tdata(bfd) -> o->stack_flags)
 #define elf_shstrtab(bfd)      (elf_tdata(bfd) -> o->strtab_ptr)
 #define elf_onesymtab(bfd)     (elf_tdata(bfd) -> symtab_section)
@@ -1945,6 +2047,8 @@ struct elf_obj_tdata
 #define elf_other_obj_attributes_proc(bfd) \
   (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC])
 #define elf_properties(bfd) (elf_tdata (bfd) -> properties)
+#define elf_has_no_copy_on_protected(bfd) \
+  (elf_tdata(bfd) -> has_no_copy_on_protected)
 \f
 extern void _bfd_elf_swap_verdef_in
   (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *);
@@ -1974,6 +2078,7 @@ extern char *bfd_elf_string_from_elf_section
 extern Elf_Internal_Sym *bfd_elf_get_elf_syms
   (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
    Elf_External_Sym_Shndx *);
+extern char * bfd_elf_get_str_section (bfd *, unsigned int);
 extern const char *bfd_elf_sym_name
   (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
 
@@ -1982,7 +2087,7 @@ extern bfd_boolean _bfd_elf_copy_private_bfd_data
 extern bfd_boolean _bfd_elf_print_private_bfd_data
   (bfd *, void *);
 const char * _bfd_elf_get_symbol_version_string
-  (bfd *, asymbol *, bfd_boolean *);
+  (bfd *, asymbol *, bfd_boolean, bfd_boolean *);
 extern void bfd_elf_print_symbol
   (bfd *, void *, asymbol *, bfd_print_symbol_type);
 
@@ -2032,6 +2137,8 @@ extern void _bfd_elf_link_hash_copy_indirect
    struct elf_link_hash_entry *);
 extern void _bfd_elf_link_hash_hide_symbol
   (struct bfd_link_info *, struct elf_link_hash_entry *, bfd_boolean);
+extern void _bfd_elf_link_hide_symbol
+  (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *);
 extern bfd_boolean _bfd_elf_link_hash_fixup_symbol
   (struct bfd_link_info *, struct elf_link_hash_entry *);
 extern bfd_boolean _bfd_elf_link_hash_table_init
@@ -2047,6 +2154,8 @@ extern bfd_boolean _bfd_elf_match_sections_by_type
   (bfd *, const asection *, bfd *, const asection *);
 extern bfd_boolean bfd_elf_is_group_section
   (bfd *, const struct bfd_section *);
+extern const char *bfd_elf_group_name
+  (bfd *, const struct bfd_section *);
 extern bfd_boolean _bfd_elf_section_already_linked
   (bfd *, asection *, struct bfd_link_info *);
 extern void bfd_elf_set_group_contents
@@ -2130,8 +2239,11 @@ extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
 extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
   (bfd *, asection *);
 
+extern bfd_boolean _bfd_elf_link_hide_sym_by_version
+  (struct bfd_link_info *, struct elf_link_hash_entry *);
+
 /* If the target doesn't have reloc handling written yet:  */
-extern void _bfd_elf_no_info_to_howto
+extern bfd_boolean _bfd_elf_no_info_to_howto
   (bfd *, arelent *, Elf_Internal_Rela *);
 
 extern bfd_boolean bfd_section_from_shdr
@@ -2167,8 +2279,12 @@ extern void _bfd_elf_strtab_restore
   (struct elf_strtab_hash *, void *);
 extern bfd_size_type _bfd_elf_strtab_size
   (struct elf_strtab_hash *);
+extern bfd_size_type _bfd_elf_strtab_len
+  (struct elf_strtab_hash *);
 extern bfd_size_type _bfd_elf_strtab_offset
   (struct elf_strtab_hash *, size_t);
+extern const char * _bfd_elf_strtab_str
+  (struct elf_strtab_hash *, size_t idx, bfd_size_type *offset);
 extern bfd_boolean _bfd_elf_strtab_emit
   (bfd *, struct elf_strtab_hash *);
 extern void _bfd_elf_strtab_finalize
@@ -2214,13 +2330,48 @@ extern bfd_boolean _bfd_elf_compute_section_file_positions
   (bfd *, struct bfd_link_info *);
 extern file_ptr _bfd_elf_assign_file_position_for_section
   (Elf_Internal_Shdr *, file_ptr, bfd_boolean);
+extern bfd_boolean _bfd_elf_modify_headers
+  (bfd *, struct bfd_link_info *);
 
 extern bfd_boolean _bfd_elf_validate_reloc
   (bfd *, arelent *);
 
+extern bfd_boolean bfd_elf_record_link_assignment
+  (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
+   bfd_boolean);
+extern bfd_boolean bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
+                                              const char *, bfd_vma);
+extern bfd_boolean bfd_elf_size_dynamic_sections
+  (bfd *, const char *, const char *, const char *, const char *, const char *,
+   const char * const *, struct bfd_link_info *, struct bfd_section **);
+extern bfd_boolean bfd_elf_size_dynsym_hash_dynstr
+  (bfd *, struct bfd_link_info *);
+extern bfd_boolean bfd_elf_get_bfd_needed_list
+  (bfd *, struct bfd_link_needed_list **);
+extern struct bfd_link_needed_list *bfd_elf_get_needed_list
+  (bfd *, struct bfd_link_info *);
+extern void bfd_elf_set_dt_needed_name
+  (bfd *, const char *);
+extern const char *bfd_elf_get_dt_soname
+  (bfd *);
+extern void bfd_elf_set_dyn_lib_class
+  (bfd *, enum dynamic_lib_link_class);
+extern int bfd_elf_get_dyn_lib_class
+  (bfd *);
+extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
+  (bfd *, struct bfd_link_info *);
+extern int bfd_elf_discard_info
+  (bfd *, struct bfd_link_info *);
+extern unsigned int _bfd_elf_default_action_discarded
+  (struct bfd_section *);
+extern struct bfd_section *_bfd_elf_tls_setup
+  (bfd *, struct bfd_link_info *);
+
 extern bfd_boolean _bfd_elf_link_create_dynamic_sections
   (bfd *, struct bfd_link_info *);
-extern bfd_boolean _bfd_elf_link_omit_section_dynsym
+extern bfd_boolean _bfd_elf_omit_section_dynsym_default
+  (bfd *, struct bfd_link_info *, asection *);
+extern bfd_boolean _bfd_elf_omit_section_dynsym_all
   (bfd *, struct bfd_link_info *, asection *);
 extern bfd_boolean _bfd_elf_create_dynamic_sections
   (bfd *, struct bfd_link_info *);
@@ -2262,11 +2413,16 @@ extern bfd_reloc_status_type bfd_elf_perform_complex_relocation
 extern bfd_boolean _bfd_elf_setup_sections
   (bfd *);
 
-extern void _bfd_elf_post_process_headers (bfd * , struct bfd_link_info *);
+extern struct bfd_link_hash_entry *bfd_elf_define_start_stop
+  (struct bfd_link_info *, const char *, asection *);
 
-extern const bfd_target *bfd_elf32_object_p
+extern bfd_boolean _bfd_elf_init_file_header (bfd *, struct bfd_link_info *);
+
+extern bfd_boolean _bfd_elf_final_write_processing (bfd *);
+
+extern bfd_cleanup bfd_elf32_object_p
   (bfd *);
-extern const bfd_target *bfd_elf32_core_file_p
+extern bfd_cleanup bfd_elf32_core_file_p
   (bfd *);
 extern char *bfd_elf32_core_file_failing_command
   (bfd *);
@@ -2276,6 +2432,8 @@ extern bfd_boolean bfd_elf32_core_file_matches_executable_p
   (bfd *, bfd *);
 extern int bfd_elf32_core_file_pid
   (bfd *);
+extern bfd_boolean _bfd_elf32_core_find_build_id
+  (bfd *, bfd_vma);
 
 extern bfd_boolean bfd_elf32_swap_symbol_in
   (bfd *, const void *, const void *, Elf_Internal_Sym *);
@@ -2310,9 +2468,9 @@ extern void bfd_elf32_write_relocs
 extern bfd_boolean bfd_elf32_slurp_reloc_table
   (bfd *, asection *, asymbol **, bfd_boolean);
 
-extern const bfd_target *bfd_elf64_object_p
+extern bfd_cleanup bfd_elf64_object_p
   (bfd *);
-extern const bfd_target *bfd_elf64_core_file_p
+extern bfd_cleanup bfd_elf64_core_file_p
   (bfd *);
 extern char *bfd_elf64_core_file_failing_command
   (bfd *);
@@ -2322,6 +2480,8 @@ extern bfd_boolean bfd_elf64_core_file_matches_executable_p
   (bfd *, bfd *);
 extern int bfd_elf64_core_file_pid
   (bfd *);
+extern bfd_boolean _bfd_elf64_core_find_build_id
+  (bfd *, bfd_vma);
 
 extern bfd_boolean bfd_elf64_swap_symbol_in
   (bfd *, const void *, const void *, Elf_Internal_Sym *);
@@ -2370,6 +2530,10 @@ extern bfd_boolean bfd_elf_link_add_symbols
   (bfd *, struct bfd_link_info *);
 extern bfd_boolean _bfd_elf_add_dynamic_entry
   (struct bfd_link_info *, bfd_vma, bfd_vma);
+extern bfd_boolean _bfd_elf_strip_zero_sized_dynamic_sections
+  (struct bfd_link_info *);
+extern int bfd_elf_add_dt_needed_tag
+  (bfd *, struct bfd_link_info *);
 extern bfd_boolean _bfd_elf_link_check_relocs
   (bfd *, struct bfd_link_info *);
 
@@ -2445,9 +2609,6 @@ extern bfd_boolean bfd_elf_gc_common_finalize_got_offsets
 extern bfd_boolean bfd_elf_gc_common_final_link
   (bfd *, struct bfd_link_info *);
 
-extern asection *_bfd_elf_is_start_stop
-  (const struct bfd_link_info *, struct elf_link_hash_entry *);
-
 extern bfd_boolean bfd_elf_reloc_symbol_deleted_p
   (bfd_vma, void *);
 
@@ -2481,7 +2642,24 @@ extern unsigned int _bfd_elf_ppc_at_tprel_transform
 /* PowerPC elf_object_p tweak.  */
 extern bfd_boolean _bfd_elf_ppc_set_arch (bfd *);
 /* PowerPC .gnu.attributes handling common to both 32-bit and 64-bit.  */
-extern void _bfd_elf_ppc_merge_fp_attributes (bfd *, struct bfd_link_info *);
+extern bfd_boolean _bfd_elf_ppc_merge_fp_attributes
+  (bfd *, struct bfd_link_info *);
+
+/* Return an upper bound on the number of bytes required to store a
+   copy of ABFD's program header table entries.  Return -1 if an error
+   occurs; bfd_get_error will return an appropriate code.  */
+extern long bfd_get_elf_phdr_upper_bound
+  (bfd *abfd);
+
+/* Copy ABFD's program header table entries to *PHDRS.  The entries
+   will be stored as an array of Elf_Internal_Phdr structures, as
+   defined in include/elf/internal.h.  To find out how large the
+   buffer needs to be, call bfd_get_elf_phdr_upper_bound.
+
+   Return the number of program header table entries read, or -1 if an
+   error occurs; bfd_get_error will return an appropriate code.  */
+extern int bfd_get_elf_phdrs
+  (bfd *abfd, void *phdrs);
 
 /* Exported interface for writing elf corefile notes.  */
 extern char *elfcore_write_note
@@ -2502,6 +2680,32 @@ extern char *elfcore_write_ppc_vmx
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_ppc_vsx
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tar
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_ppr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_dscr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_ebb
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_pmu
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cgpr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cfpr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cvmx
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cvsx
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_spr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_ctar
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cppr
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_ppc_tm_cdscr
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_s390_timer
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_s390_todcmp
@@ -2522,6 +2726,10 @@ extern char *elfcore_write_s390_vxrs_low
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_s390_vxrs_high
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_cb
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_s390_gs_bc
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_arm_vfp
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_aarch_tls
@@ -2530,6 +2738,12 @@ extern char *elfcore_write_aarch_hw_break
   (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_aarch_hw_watch
   (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_sve
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_aarch_pauth
+  (bfd *, char *, int *, const void *, int);
+extern char *elfcore_write_arc_v2
+  (bfd *, char *, int *, const void *, int);
 extern char *elfcore_write_lwpstatus
   (bfd *, char *, int *, long, int, const void *);
 extern char *elfcore_write_register_note
@@ -2567,10 +2781,6 @@ extern char *elfcore_write_linux_prpsinfo32
 extern char *elfcore_write_linux_prpsinfo64
   (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
 
-/* Linux/PPC32 uses different layout compared to most archs.  */
-extern char *elfcore_write_ppc_linux_prpsinfo32
-  (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
-
 extern bfd *_bfd_elf32_bfd_from_remote_memory
   (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
    int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type));
@@ -2602,6 +2812,7 @@ extern bfd_boolean _bfd_elf_merge_object_attributes
 extern bfd_boolean _bfd_elf_merge_unknown_attribute_low (bfd *, bfd *, int);
 extern bfd_boolean _bfd_elf_merge_unknown_attribute_list (bfd *, bfd *);
 extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr (asection *sec);
+extern bfd_boolean elf_read_notes (bfd *, file_ptr, bfd_size_type, size_t);
 
 extern bfd_boolean _bfd_elf_parse_gnu_properties
   (bfd *, Elf_Internal_Note *);
@@ -2609,6 +2820,10 @@ extern elf_property * _bfd_elf_get_property
   (bfd *, unsigned int, unsigned int);
 extern bfd *_bfd_elf_link_setup_gnu_properties
   (struct bfd_link_info *);
+extern bfd_size_type _bfd_elf_convert_gnu_property_size
+  (bfd *, bfd *);
+extern bfd_boolean _bfd_elf_convert_gnu_properties
+  (bfd *, asection *, bfd *, bfd_byte **, bfd_size_type *);
 
 /* The linker may need to keep track of the number of relocs that it
    decides to copy as dynamic relocs in check_relocs for each symbol.
@@ -2636,9 +2851,6 @@ extern bfd_boolean _bfd_elf_allocate_ifunc_dyn_relocs
   (struct bfd_link_info *, struct elf_link_hash_entry *,
    struct elf_dyn_relocs **, bfd_boolean *, unsigned int,
    unsigned int, unsigned int, bfd_boolean);
-extern long _bfd_elf_ifunc_get_synthetic_symtab
-  (bfd *, long, asymbol **, long, asymbol **, asymbol **, asection *,
-   bfd_vma *(*) (bfd *, asymbol **, asection *, asection *));
 
 extern void elf_append_rela (bfd *, asection *, Elf_Internal_Rela *);
 extern void elf_append_rel (bfd *, asection *, Elf_Internal_Rela *);
@@ -2648,14 +2860,33 @@ extern bfd_vma elf64_r_sym (bfd_vma);
 extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
 extern bfd_vma elf32_r_sym (bfd_vma);
 
+extern bfd_boolean is_debuginfo_file (bfd *);
+
+
+extern bfd_boolean _bfd_elf_init_secondary_reloc_section
+  (bfd *, Elf_Internal_Shdr *, const char *, unsigned int);
+extern bfd_boolean _bfd_elf_slurp_secondary_reloc_section
+  (bfd *, asection *, asymbol **);
+extern bfd_boolean _bfd_elf_copy_special_section_fields
+  (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *);
+extern bfd_boolean _bfd_elf_write_secondary_reloc_section
+  (bfd *, asection *);
+extern unsigned int _bfd_elf_symbol_section_index
+  (bfd *, elf_symbol_type *);
+
+extern asection *_bfd_elf_readonly_dynrelocs
+  (struct elf_link_hash_entry *);
+extern bfd_boolean _bfd_elf_maybe_set_textrel
+  (struct elf_link_hash_entry *, void *);
+
 /* Large common section.  */
 extern asection _bfd_elf_large_com_section;
 
 /* Hash for local symbol with the first section id, ID, in the input
    file and the local symbol index, SYM.  */
 #define ELF_LOCAL_SYMBOL_HASH(ID, SYM) \
-  (((((ID) & 0xff) << 24) | (((ID) & 0xff00) << 8)) \
-   ^ (SYM) ^ ((ID) >> 16))
+  (((((ID) & 0xffU) << 24) | (((ID) & 0xff00) << 8)) \
+   ^ (SYM) ^ (((ID) & 0xffff0000U) >> 16))
 
 /* This is the condition under which finish_dynamic_symbol will be called.
    If our finish_dynamic_symbol isn't called, we'll need to do something
@@ -2717,8 +2948,9 @@ extern asection _bfd_elf_large_com_section;
       else if (!bfd_link_relocatable (info))                           \
        {                                                               \
          bfd_boolean err;                                              \
-         err = (info->unresolved_syms_in_objects == RM_GENERATE_ERROR  \
-                || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);       \
+         err = (info->unresolved_syms_in_objects == RM_DIAGNOSE &&     \
+                !info->warn_unresolved_syms)                           \
+                || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT;        \
          (*info->callbacks->undefined_symbol) (info,                   \
                                                h->root.root.string,    \
                                                input_bfd,              \
@@ -2746,7 +2978,7 @@ extern asection _bfd_elf_large_com_section;
   {                                                                    \
     int i_;                                                            \
     _bfd_clear_contents (howto, input_bfd, input_section,              \
-                        contents + rel[index].r_offset);               \
+                        contents, rel[index].r_offset);                \
                                                                        \
     if (bfd_link_relocatable (info)                                    \
        && (input_section->flags & SEC_DEBUGGING))                      \
@@ -2787,7 +3019,17 @@ extern asection _bfd_elf_large_com_section;
    library, if any.  A unique symbol can never be bound locally.  */
 #define SYMBOLIC_BIND(INFO, H) \
     (!(H)->unique_global \
-     && ((INFO)->symbolic || ((INFO)->dynamic && !(H)->dynamic)))
+     && ((INFO)->symbolic \
+        || (H)->start_stop \
+        || ((INFO)->dynamic && !(H)->dynamic)))
+
+/* Determine if a section contains CTF data, using its name.  */
+static inline bfd_boolean
+bfd_section_is_ctf (const asection *sec)
+{
+  const char *name = bfd_section_name (sec);
+  return strncmp (name, ".ctf", 4) == 0 && (name[4] == 0 || name[4] == '.');
+}
 
 #ifdef __cplusplus
 }
This page took 0.033718 seconds and 4 git commands to generate.