Home | History | Annotate | Line # | Download | only in bfd
      1 /* BFD back-end data structures for ELF files.
      2    Copyright (C) 1992-2026 Free Software Foundation, Inc.
      3    Written by Cygnus Support.
      4 
      5    This file is part of BFD, the Binary File Descriptor library.
      6 
      7    This program is free software; you can redistribute it and/or modify
      8    it under the terms of the GNU General Public License as published by
      9    the Free Software Foundation; either version 3 of the License, or
     10    (at your option) any later version.
     11 
     12    This program is distributed in the hope that it will be useful,
     13    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15    GNU General Public License for more details.
     16 
     17    You should have received a copy of the GNU General Public License
     18    along with this program; if not, write to the Free Software
     19    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     20    MA 02110-1301, USA.  */
     21 
     22 #ifndef _LIBELF_H_
     23 #define _LIBELF_H_ 1
     24 
     25 #include <stdlib.h>
     26 
     27 #include "doubly-linked-list.h"
     28 #include "elf/common.h"
     29 #include "elf/external.h"
     30 #include "elf/internal.h"
     31 #include "elf-attrs.h"
     32 #include "bfdlink.h"
     33 
     34 #ifndef ENABLE_CHECKING
     35 #define ENABLE_CHECKING 0
     36 #endif
     37 
     38 #include "hidden.h"
     39 
     40 #ifdef __cplusplus
     41 extern "C" {
     42 #endif
     43 
     44 /* The number of entries in a section is its size divided by the size
     45    of a single entry.  This is normally only applicable to reloc and
     46    symbol table sections.
     47    PR 9934: It is possible to have relocations that do not refer to
     48    symbols, thus it is also possible to have a relocation section in
     49    an object file, but no symbol table.  */
     50 #define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_entsize > 0 ? (shdr)->sh_size / (shdr)->sh_entsize : 0)
     51 
     52 /* If size isn't specified as 64 or 32, NAME macro should fail.  */
     53 #if !defined(NAME) && defined(ARCH_SIZE)
     54 #if ARCH_SIZE == 64
     55 #define NAME(x, y) x ## 64 ## _ ## y
     56 #endif
     57 #if ARCH_SIZE == 32
     58 #define NAME(x, y) x ## 32 ## _ ## y
     59 #endif
     60 #endif
     61 
     62 #ifndef NAME
     63 #define NAME(x, y) x ## NOSIZE ## _ ## y
     64 #endif
     65 
     66 #define ElfNAME(X)	NAME(Elf,X)
     67 #define elfNAME(X)	NAME(elf,X)
     68 
     69 /* Information held for an ELF symbol.  The first field is the
     70    corresponding asymbol.  Every symbol is an ELF file is actually a
     71    pointer to this structure, although it is often handled as a
     72    pointer to an asymbol.  */
     73 
     74 typedef struct
     75 {
     76   /* The BFD symbol.  */
     77   asymbol symbol;
     78   /* ELF symbol information.  */
     79   Elf_Internal_Sym internal_elf_sym;
     80   /* Backend specific information.  */
     81   union
     82     {
     83       unsigned int hppa_arg_reloc;
     84       void *mips_extr;
     85       void *any;
     86     }
     87   tc_data;
     88 
     89   /* Version information.  This is from an Elf_Internal_Versym
     90      structure in a SHT_GNU_versym section.  It is zero if there is no
     91      version information.  */
     92   unsigned short version;
     93 
     94 } elf_symbol_type;
     95 
     96 struct elf_strtab_hash;
     98 struct got_entry;
     99 struct plt_entry;
    100 
    101 union gotplt_union
    102   {
    103     bfd_signed_vma refcount;
    104     bfd_vma offset;
    105     struct got_entry *glist;
    106     struct plt_entry *plist;
    107   };
    108 
    109 struct elf_link_virtual_table_entry
    110   {
    111     /* Virtual table entry use information.  This array is nominally of size
    112        size/sizeof(target_void_pointer), though we have to be able to assume
    113        and track a size while the symbol is still undefined.  It is indexed
    114        via offset/sizeof(target_void_pointer).  */
    115     size_t size;
    116     bool *used;
    117 
    118     /* Virtual table derivation info.  */
    119     struct elf_link_hash_entry *parent;
    120   };
    121 
    122 /* ELF symbol version.  */
    123 enum elf_symbol_version
    124   {
    125     unknown = 0,
    126     unversioned,
    127     versioned,
    128     versioned_hidden
    129   };
    130 
    131 /* ELF linker hash table entries.  */
    132 
    133 struct elf_link_hash_entry
    134 {
    135   struct bfd_link_hash_entry root;
    136 
    137   /* Symbol index in output file.  This is initialized to -1.  It is
    138      set to -2 if the symbol is used by a reloc.  It is set to -3 if
    139      this symbol is defined in a discarded section.  */
    140   long indx;
    141 
    142   /* Symbol index as a dynamic symbol.  Initialized to -1, and remains
    143      -1 if this is not a dynamic symbol.  */
    144   /* ??? Note that this is consistently used as a synonym for tests
    145      against whether we can perform various simplifying transformations
    146      to the code.  (E.g. changing a pc-relative jump to a PLT entry
    147      into a pc-relative jump to the target function.)  That test, which
    148      is often relatively complex, and someplaces wrong or incomplete,
    149      should really be replaced by a predicate in elflink.c.
    150 
    151      End result: this field -1 does not indicate that the symbol is
    152      not in the dynamic symbol table, but rather that the symbol is
    153      not visible outside this DSO.  */
    154   long dynindx;
    155 
    156   /* If this symbol requires an entry in the global offset table, the
    157      processor specific backend uses this field to track usage and
    158      final offset.  Two schemes are supported:  The first assumes that
    159      a symbol may only have one GOT entry, and uses REFCOUNT until
    160      size_dynamic_sections, at which point the contents of the .got is
    161      fixed.  Afterward, if OFFSET is -1, then the symbol does not
    162      require a global offset table entry.  The second scheme allows
    163      multiple GOT entries per symbol, managed via a linked list
    164      pointed to by GLIST.  */
    165   union gotplt_union got;
    166 
    167   /* Same, but tracks a procedure linkage table entry.  */
    168   union gotplt_union plt;
    169 
    170   /* Symbol size.  NB: All fields starting from here are cleared by
    171     _bfd_elf_link_hash_newfunc.  */
    172   bfd_size_type size;
    173 
    174   /* Track dynamic relocs copied for this symbol.  */
    175   struct elf_dyn_relocs *dyn_relocs;
    176 
    177   /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */
    178   unsigned int type : 8;
    179 
    180   /* Symbol st_other value, symbol visibility.  */
    181   unsigned int other : 8;
    182 
    183   /* The symbol's st_target_internal value (see Elf_Internal_Sym).  */
    184   unsigned int target_internal : 8;
    185 
    186   /* Symbol is referenced by a non-shared object (other than the object
    187      in which it is defined).  */
    188   unsigned int ref_regular : 1;
    189   /* Symbol is defined by a non-shared object.  */
    190   unsigned int def_regular : 1;
    191   /* Symbol is referenced by a shared object.  */
    192   unsigned int ref_dynamic : 1;
    193   /* Symbol is defined by a shared object.  */
    194   unsigned int def_dynamic : 1;
    195   /* Symbol has a non-weak reference from a non-shared object (other than
    196      the object in which it is defined).  */
    197   unsigned int ref_regular_nonweak : 1;
    198   /* Symbol has a non-weak reference from a LTO IR object file.  */
    199   unsigned int ref_ir_nonweak : 1;
    200   /* Dynamic symbol has been adjustd.  */
    201   unsigned int dynamic_adjusted : 1;
    202   /* Symbol needs a copy reloc.  */
    203   unsigned int needs_copy : 1;
    204   /* Symbol needs a procedure linkage table entry.  */
    205   unsigned int needs_plt : 1;
    206   /* Symbol appears in a non-ELF input file.  */
    207   unsigned int non_elf : 1;
    208   /* Symbol version information.  */
    209   ENUM_BITFIELD (elf_symbol_version) versioned : 2;
    210   /* Symbol is a base symbol.  */
    211   unsigned int base_symbol : 1;
    212   /* Symbol was forced to local scope due to a version script file.  */
    213   unsigned int forced_local : 1;
    214   /* Symbol was forced to be dynamic due to a version script file.  */
    215   unsigned int dynamic : 1;
    216   /* Symbol was marked during garbage collection.  */
    217   unsigned int mark : 1;
    218   /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is
    219      not currently set by all the backends.  */
    220   unsigned int non_got_ref : 1;
    221   /* Symbol has a definition in a shared object.
    222      FIXME: There is no real need for this field if def_dynamic is never
    223      cleared and all places that test def_dynamic also test def_regular.  */
    224   unsigned int dynamic_def : 1;
    225   /* Symbol has a non-weak reference from a shared object.  */
    226   unsigned int ref_dynamic_nonweak : 1;
    227   /* Symbol is referenced with a relocation where C/C++ pointer equality
    228      matters.  */
    229   unsigned int pointer_equality_needed : 1;
    230   /* Symbol is a unique global symbol.  */
    231   unsigned int unique_global : 1;
    232   /* Symbol is defined by a shared library with non-default visibility
    233      in a read/write section.  */
    234   unsigned int protected_def : 1;
    235   /* Symbol is __start_SECNAME or __stop_SECNAME to mark section
    236      SECNAME.  */
    237   unsigned int start_stop : 1;
    238   /* Symbol is or was a weak defined symbol from a dynamic object with
    239      a strong defined symbol alias.  U.ALIAS points to a list of aliases,
    240      the definition having is_weakalias clear.  */
    241   unsigned int is_weakalias : 1;
    242   /* Symbol has a relocation.  */
    243   unsigned int has_reloc : 1;
    244 
    245   /* String table index in .dynstr if this is a dynamic symbol.  */
    246   unsigned long dynstr_index;
    247 
    248   union
    249   {
    250     /* Points to a circular list of non-function symbol aliases.  */
    251     struct elf_link_hash_entry *alias;
    252 
    253     /* Hash value of the name computed using the ELF hash function.
    254        Used part way through size_dynamic_sections, after we've finished
    255        with aliases.  */
    256     unsigned long elf_hash_value;
    257   } u;
    258 
    259   /* Version information.  */
    260   union
    261   {
    262     /* This field is used for a symbol which is not defined in a
    263        regular object.  It points to the version information read in
    264        from the dynamic object.  */
    265     Elf_Internal_Verdef *verdef;
    266     /* This field is used for a symbol which is defined in a regular
    267        object.  It is set up in size_dynamic_sections.  It points to
    268        the version information we should write out for this symbol.  */
    269     struct bfd_elf_version_tree *vertree;
    270   } verinfo;
    271 
    272   union
    273   {
    274     /* For __start_SECNAME and __stop_SECNAME symbols, record the first
    275        input section whose section name is SECNAME.  */
    276     asection *start_stop_section;
    277 
    278     /* Vtable information. */
    279     struct elf_link_virtual_table_entry *vtable;
    280   } u2;
    281 };
    282 
    283 /* Return the strong definition for a weak symbol with aliases.  */
    284 
    285 static inline struct elf_link_hash_entry *
    286 weakdef (struct elf_link_hash_entry *h)
    287 {
    288   while (h->is_weakalias)
    289     h = h->u.alias;
    290   return h;
    291 }
    292 
    293 /* Will references to this symbol always reference the symbol
    294    in this object?  */
    295 #define SYMBOL_REFERENCES_LOCAL(INFO, H) \
    296   _bfd_elf_symbol_refs_local_p (H, INFO, 0)
    297 
    298 /* Will _calls_ to this symbol always call the version in this object?  */
    299 #define SYMBOL_CALLS_LOCAL(INFO, H) \
    300   _bfd_elf_symbol_refs_local_p (H, INFO, 1)
    301 
    302 /* Whether an undefined weak symbol should resolve to its link-time
    303    value, even in PIC or PIE objects.  The linker_def test is to
    304    handle symbols like __ehdr_start that may be undefweak in early
    305    stages of linking but are guaranteed to be defined later.  */
    306 #define UNDEFWEAK_NO_DYNAMIC_RELOC(INFO, H)		\
    307   ((H)->root.type == bfd_link_hash_undefweak		\
    308    && !(H)->root.linker_def				\
    309    && (ELF_ST_VISIBILITY ((H)->other) != STV_DEFAULT	\
    310        || (INFO)->dynamic_undefined_weak == 0))
    311 
    312 /* Common symbols that are turned into definitions don't have the
    313    DEF_REGULAR flag set, so they might appear to be undefined.
    314    Symbols defined in linker scripts also don't have DEF_REGULAR set.  */
    315 #define ELF_COMMON_DEF_P(H) \
    316   (!(H)->def_regular							\
    317    && !(H)->def_dynamic							\
    318    && (H)->root.type == bfd_link_hash_defined)
    319 
    320 /* Records local symbols to be emitted in the dynamic symbol table.  */
    321 
    322 struct elf_link_local_dynamic_entry
    323 {
    324   struct elf_link_local_dynamic_entry *next;
    325 
    326   /* The input bfd this symbol came from.  */
    327   bfd *input_bfd;
    328 
    329   /* The index of the local symbol being copied.  */
    330   long input_indx;
    331 
    332   /* The index in the outgoing dynamic symbol table.  */
    333   long dynindx;
    334 
    335   /* A copy of the input symbol.  */
    336   Elf_Internal_Sym isym;
    337 };
    338 
    339 struct elf_link_loaded_list
    340 {
    341   struct elf_link_loaded_list *next;
    342   bfd *abfd;
    343 };
    344 
    345 /* Structures used by the eh_frame optimization code.  */
    346 struct eh_cie_fde
    347 {
    348   union {
    349     struct {
    350       /* If REMOVED == 1, this is the CIE that the FDE originally used.
    351 	 The CIE belongs to the same .eh_frame input section as the FDE.
    352 
    353 	 If REMOVED == 0, this is the CIE that we have chosen to use for
    354 	 the output FDE.  The CIE's REMOVED field is also 0, but the CIE
    355 	 might belong to a different .eh_frame input section from the FDE.
    356 
    357 	 May be NULL to signify that the FDE should be discarded.  */
    358       struct eh_cie_fde *cie_inf;
    359       struct eh_cie_fde *next_for_section;
    360     } fde;
    361     struct {
    362       /* CIEs have three states:
    363 
    364 	 - REMOVED && !MERGED: Slated for removal because we haven't yet
    365 	   proven that an FDE needs it.  FULL_CIE, if nonnull, points to
    366 	   more detailed information about the CIE.
    367 
    368 	 - REMOVED && MERGED: We have merged this CIE with MERGED_WITH,
    369 	   which may not belong to the same input section.
    370 
    371 	 - !REMOVED: We have decided to keep this CIE.  SEC is the
    372 	   .eh_frame input section that contains the CIE.  */
    373       union {
    374 	struct cie *full_cie;
    375 	struct eh_cie_fde *merged_with;
    376 	asection *sec;
    377       } u;
    378 
    379       /* The offset of the personality data from the start of the CIE,
    380 	 or 0 if the CIE doesn't have any.  */
    381       unsigned int personality_offset : 8;
    382 
    383       /* Length of augmentation.  aug_str_len is the length of the
    384 	 string including null terminator.  aug_data_len is the length
    385 	 of the rest up to the initial insns.  */
    386       unsigned int aug_str_len : 3;
    387       unsigned int aug_data_len : 5;
    388 
    389       /* True if we have marked relocations associated with this CIE.  */
    390       unsigned int gc_mark : 1;
    391 
    392       /* True if we have decided to turn an absolute LSDA encoding into
    393 	 a PC-relative one.  */
    394       unsigned int make_lsda_relative : 1;
    395 
    396       /* True if we have decided to turn an absolute personality
    397 	 encoding into a PC-relative one.  */
    398       unsigned int make_per_encoding_relative : 1;
    399 
    400       /* True if the CIE contains personality data and if that
    401 	 data uses a PC-relative encoding.  Always true when
    402 	 make_per_encoding_relative is.  */
    403       unsigned int per_encoding_relative : 1;
    404 
    405       /* True if the CIE contains personality data aligned to a
    406 	 multiple of eight bytes.  */
    407       unsigned int per_encoding_aligned8 : 1;
    408 
    409       /* True if we need to add an 'R' (FDE encoding) entry to the
    410 	 CIE's augmentation data.  */
    411       unsigned int add_fde_encoding : 1;
    412 
    413       /* True if we have merged this CIE with another.  */
    414       unsigned int merged : 1;
    415 
    416       /* Unused bits.  */
    417       unsigned int pad1 : 9;
    418     } cie;
    419   } u;
    420   unsigned int reloc_index;
    421   unsigned int size;
    422   unsigned int offset;
    423   unsigned int new_offset;
    424   unsigned int fde_encoding : 8;
    425   unsigned int lsda_encoding : 8;
    426   unsigned int lsda_offset : 8;
    427 
    428   /* True if this entry represents a CIE, false if it represents an FDE.  */
    429   unsigned int cie : 1;
    430 
    431   /* True if this entry is currently marked for removal.  */
    432   unsigned int removed : 1;
    433 
    434   /* True if we need to add a 'z' (augmentation size) entry to the CIE's
    435      augmentation data, and an associated byte to each of the CIE's FDEs.  */
    436   unsigned int add_augmentation_size : 1;
    437 
    438   /* True if we have decided to convert absolute FDE relocations into
    439      relative ones.  This applies to the first relocation in the FDE,
    440      which is against the code that the FDE describes.  */
    441   unsigned int make_relative : 1;
    442 
    443   /* Unused bits.  */
    444   unsigned int pad1 : 4;
    445 
    446   unsigned int *set_loc;
    447 };
    448 
    449 struct eh_frame_sec_info
    450 {
    451   unsigned int count;
    452   struct cie *cies;
    453   struct eh_cie_fde entry[1];
    454 };
    455 
    456 struct eh_frame_array_ent
    457 {
    458   bfd_vma initial_loc;
    459   bfd_size_type range;
    460   bfd_vma fde;
    461 };
    462 
    463 struct htab;
    464 
    465 #define DWARF2_EH_HDR 1
    466 #define COMPACT_EH_HDR 2
    467 
    468 /* Endian-neutral code indicating that a function cannot be unwound.  */
    469 #define COMPACT_EH_CANT_UNWIND_OPCODE 0x015d5d01
    470 
    471 struct dwarf_eh_frame_hdr_info
    472 {
    473   struct htab *cies;
    474   unsigned int fde_count;
    475   /* TRUE if .eh_frame_hdr should contain the sorted search table.
    476      We build it if we successfully read all .eh_frame input sections
    477      and recognize them.  */
    478   bool table;
    479   struct eh_frame_array_ent *array;
    480 };
    481 
    482 struct compact_eh_frame_hdr_info
    483 {
    484   unsigned int allocated_entries;
    485   /* eh_frame_entry fragments.  */
    486   asection **entries;
    487 };
    488 
    489 struct eh_frame_hdr_info
    490 {
    491   asection *hdr_sec;
    492   unsigned int array_count;
    493   bool frame_hdr_is_compact;
    494   union
    495     {
    496       struct dwarf_eh_frame_hdr_info dwarf;
    497       struct compact_eh_frame_hdr_info compact;
    498     }
    499   u;
    500 };
    501 
    502 /* Additional information for each function (used at link time).  */
    503 struct sframe_func_bfdinfo
    504 {
    505   /* Whether the function has been discarded from the final output.  */
    506   bool func_deleted_p;
    507   /* Relocation offset.  */
    508   unsigned int func_r_offset;
    509   /* Relocation index.  */
    510   unsigned int func_reloc_index;
    511 };
    512 
    513 /* Link state information of the SFrame section.  */
    514 enum sframe_sec_state
    515 {
    516   SFRAME_SEC_DECODED = 1,
    517   SFRAME_SEC_MERGED,
    518 };
    519 
    520 /* SFrame decoder info.
    521    Contains all information for a decoded .sframe section.  */
    522 struct sframe_dec_info
    523 {
    524   /* Decoder context.  */
    525   struct sframe_decoder_ctx *sfd_ctx;
    526   /* SFrame section state as it progresses through the link process.  */
    527   enum sframe_sec_state sfd_state;
    528   /* Number of function descriptor entries in this .sframe.  */
    529   unsigned int sfd_fde_count;
    530   /* Additional information for linking.  */
    531   struct sframe_func_bfdinfo *sfd_func_bfdinfo;
    532 };
    533 
    534 /* SFrame encoder info.
    535    Contains all information for an encoded .sframe section to be
    536    written out.  */
    537 struct sframe_enc_info
    538 {
    539   /* Encoder context.  */
    540   struct sframe_encoder_ctx *sfe_ctx;
    541   /* Output section.  */
    542   asection *sframe_section;
    543 };
    544 
    545 /* Enum used to identify target specific extensions to the elf_obj_tdata
    546    and elf_link_hash_table structures.  Note the enums deliberately start
    547    from 1 so that we can detect an uninitialized field.  The generic value
    548    is last so that additions to this enum do not need to modify more than
    549    one line.  */
    550 enum elf_target_id
    551 {
    552   AARCH64_ELF_DATA = 1,
    553   ALPHA_ELF_DATA,
    554   AMDGCN_ELF_DATA,
    555   ARC_ELF_DATA,
    556   ARM_ELF_DATA,
    557   AVR_ELF_DATA,
    558   BFIN_ELF_DATA,
    559   CR16_ELF_DATA,
    560   CRIS_ELF_DATA,
    561   CSKY_ELF_DATA,
    562   FRV_ELF_DATA,
    563   HPPA32_ELF_DATA,
    564   HPPA64_ELF_DATA,
    565   I386_ELF_DATA,
    566   IA64_ELF_DATA,
    567   KVX_ELF_DATA,
    568   LARCH_ELF_DATA,
    569   LM32_ELF_DATA,
    570   M32R_ELF_DATA,
    571   M68HC11_ELF_DATA,
    572   M68K_ELF_DATA,
    573   METAG_ELF_DATA,
    574   MICROBLAZE_ELF_DATA,
    575   MIPS_ELF_DATA,
    576   MMIX_ELF_DATA,
    577   MN10300_ELF_DATA,
    578   NDS32_ELF_DATA,
    579   OR1K_ELF_DATA,
    580   PPC32_ELF_DATA,
    581   PPC64_ELF_DATA,
    582   PRU_ELF_DATA,
    583   RISCV_ELF_DATA,
    584   S390_ELF_DATA,
    585   SCORE_ELF_DATA,
    586   SH_ELF_DATA,
    587   SPARC_ELF_DATA,
    588   SPU_ELF_DATA,
    589   TIC6X_ELF_DATA,
    590   TILEGX_ELF_DATA,
    591   TILEPRO_ELF_DATA,
    592   VAX_ELF_DATA,
    593   WEBASSEMBLY_ELF_DATA,
    594   X86_64_ELF_DATA,
    595   XTENSA_ELF_DATA,
    596   GENERIC_ELF_DATA
    597 };
    598 
    599 struct elf_sym_strtab
    600 {
    601   Elf_Internal_Sym sym;
    602   unsigned long dest_index;
    603 };
    604 
    605 struct bfd_link_needed_list
    606 {
    607   struct bfd_link_needed_list *next;
    608   bfd *by;
    609   const char *name;
    610 };
    611 
    612 enum elf_target_os
    613 {
    614   is_normal,
    615   is_solaris,	/* Solaris.  */
    616   is_vxworks	/* VxWorks.  */
    617 };
    618 
    619 /* Used by bfd_sym_from_r_symndx to cache a small number of local
    620    symbols.  */
    621 #define LOCAL_SYM_CACHE_SIZE 32
    622 struct sym_cache
    623 {
    624   bfd *abfd;
    625   unsigned long indx[LOCAL_SYM_CACHE_SIZE];
    626   Elf_Internal_Sym sym[LOCAL_SYM_CACHE_SIZE];
    627 };
    628 
    629 /* ELF linker hash table.  */
    630 
    631 struct elf_link_hash_table
    632 {
    633   struct bfd_link_hash_table root;
    634 
    635   /* An identifier used to distinguish different target
    636      specific extensions to this structure.  */
    637   enum elf_target_id hash_table_id;
    638 
    639   /* Whether we have created the special dynamic sections required
    640      when linking against or generating a shared object.  */
    641   bool dynamic_sections_created;
    642 
    643   /* Whether dynamic relocations are present.  */
    644   bool dynamic_relocs;
    645 
    646   /* TRUE if there are local dynamic symbols.  */
    647   bool has_local_dynsyms;
    648 
    649   /* True if this target has relocatable executables, so needs dynamic
    650      section symbols.  */
    651   bool is_relocatable_executable;
    652 
    653   /* TRUE if there are IFUNC resolvers.  */
    654   bool ifunc_resolvers;
    655 
    656   /* TRUE if DT_PLTGOT is a required dynamic tag.  */
    657   bool dt_pltgot_required;
    658 
    659   /* TRUE if DT_JMPREL is a required dynamic tag.  */
    660   bool dt_jmprel_required;
    661 
    662   /* TRUE when we are handling DT_NEEDED entries.  */
    663   bool handling_dt_needed;
    664 
    665   /* TRUE if there are base symbols.  */
    666   bool has_base_symbols;
    667 
    668   /* The BFD used to hold special sections created by the linker.
    669      This will be the first BFD found which requires these sections to
    670      be created.  */
    671   bfd *dynobj;
    672 
    673   /* The value to use when initialising got.refcount/offset and
    674      plt.refcount/offset in an elf_link_hash_entry.  Set to zero when
    675      the values are refcounts.  Set to init_got_offset/init_plt_offset
    676      in size_dynamic_sections when the values may be offsets.  */
    677   union gotplt_union init_got_refcount;
    678   union gotplt_union init_plt_refcount;
    679 
    680   /* The value to use for got.refcount/offset and plt.refcount/offset
    681      when the values may be offsets.  Normally (bfd_vma) -1.  */
    682   union gotplt_union init_got_offset;
    683   union gotplt_union init_plt_offset;
    684 
    685   /* The number of symbols found in the link which is intended for the
    686      mandatory DT_SYMTAB tag (.dynsym section) in .dynamic section.  */
    687   bfd_size_type dynsymcount;
    688   bfd_size_type local_dynsymcount;
    689 
    690   /* The string table of dynamic symbols, which becomes the .dynstr
    691      section.  */
    692   struct elf_strtab_hash *dynstr;
    693 
    694   /* The array size of the symbol string table, which becomes the
    695      .strtab section.  */
    696   bfd_size_type strtabsize;
    697 
    698   /* The array of strings, which becomes the .strtab section.  */
    699   struct elf_sym_strtab *strtab;
    700 
    701   /* The number of buckets in the hash table in the .hash section.
    702      This is based on the number of dynamic symbols.  */
    703   bfd_size_type bucketcount;
    704 
    705   /* A linked list of DT_NEEDED names found in dynamic objects
    706      included in the link.  */
    707   struct bfd_link_needed_list *needed;
    708 
    709   /* Sections in the output bfd that provides a section symbol
    710      to be used by relocations emitted against local symbols.
    711      Most targets will not use data_index_section.  */
    712   asection *text_index_section;
    713   asection *data_index_section;
    714 
    715   /* The _GLOBAL_OFFSET_TABLE_ symbol.  */
    716   struct elf_link_hash_entry *hgot;
    717 
    718   /* The _PROCEDURE_LINKAGE_TABLE_ symbol.  */
    719   struct elf_link_hash_entry *hplt;
    720 
    721   /* The _DYNAMIC symbol.  */
    722   struct elf_link_hash_entry *hdynamic;
    723 
    724   /* The __ehdr_start symbol.  */
    725   struct elf_link_hash_entry *hehdr_start;
    726 
    727   /* Used to link stabs in sections.  */
    728   struct stab_info stab_info;
    729 
    730   /* Used by eh_frame code when editing .eh_frame.  */
    731   struct eh_frame_hdr_info eh_info;
    732 
    733   /* Used to link stack trace info in .sframe sections.  */
    734   struct sframe_enc_info sfe_info;
    735 
    736   /* A linked list of local symbols to be added to .dynsym.  */
    737   struct elf_link_local_dynamic_entry *dynlocal;
    738 
    739   /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic
    740      objects included in the link.  */
    741   struct bfd_link_needed_list *runpath;
    742 
    743   /* Cached first output tls section and size of PT_TLS segment.  */
    744   asection *tls_sec;
    745   bfd_size_type tls_size;  /* Bytes.  */
    746 
    747   /* The offset into splt of the PLT entry for the TLS descriptor
    748      resolver.  Special values are 0, if not necessary (or not found
    749      to be necessary yet), and -1 if needed but not determined
    750      yet.  */
    751   bfd_vma tlsdesc_plt;
    752 
    753   /* The GOT offset for the lazy trampoline.  Communicated to the
    754      loader via DT_TLSDESC_GOT.  The magic value (bfd_vma) -1
    755      indicates an offset is not allocated.  */
    756   bfd_vma tlsdesc_got;
    757 
    758   /* Target OS for linker output.  */
    759   enum elf_target_os target_os;
    760 
    761   /* A linked list of dynamic BFD's loaded in the link.  */
    762   struct elf_link_loaded_list *dyn_loaded;
    763 
    764   /* Small local sym cache.  */
    765   struct sym_cache sym_cache;
    766 
    767   /* Hash table of symbols which are first defined in archives or shared
    768      objects when there are any IR inputs.  */
    769   struct bfd_hash_table *first_hash;
    770 
    771   /* Short-cuts to get to dynamic linker sections.  */
    772   asection *sgot;
    773   asection *sgotplt;
    774   asection *srelgot;
    775   asection *splt;
    776   asection *srelplt;
    777   asection *sdynbss;
    778   asection *srelbss;
    779   asection *sdynrelro;
    780   asection *sreldynrelro;
    781   asection *igotplt;
    782   asection *iplt;
    783   asection *irelplt;
    784   asection *irelifunc;
    785   asection *dynsym;
    786   asection *srelrdyn;
    787   asection *dynamic;
    788   asection *interp;
    789 };
    790 
    791 /* Returns TRUE if the hash table is a struct elf_link_hash_table.  */
    792 
    793 static inline bool
    794 is_elf_hash_table (const struct bfd_link_hash_table *htab)
    795 {
    796   return htab->type == bfd_link_elf_hash_table;
    797 }
    798 
    799 /* Look up an entry in an ELF linker hash table.  */
    800 
    801 static inline struct elf_link_hash_entry *
    802 elf_link_hash_lookup (struct elf_link_hash_table *table, const char *string,
    803 		      bool create, bool copy, bool follow)
    804 {
    805   if (ENABLE_CHECKING && !is_elf_hash_table (&table->root))
    806     abort ();
    807   return (struct elf_link_hash_entry *)
    808     bfd_link_hash_lookup (&table->root, string, create, copy, follow);
    809 }
    810 
    811 /* Traverse an ELF linker hash table.  */
    812 
    813 static inline void
    814 elf_link_hash_traverse (struct elf_link_hash_table *table,
    815 			bool (*f) (struct elf_link_hash_entry *, void *),
    816 			void *info)
    817 {
    818   if (ENABLE_CHECKING && !is_elf_hash_table (&table->root))
    819     abort ();
    820   bfd_link_hash_traverse (&table->root,
    821 			  (bool (*) (struct bfd_link_hash_entry *, void *)) f,
    822 			  info);
    823 }
    824 
    825 /* Get the ELF linker hash table from a link_info structure.  */
    826 
    827 static inline struct elf_link_hash_table *
    828 elf_hash_table (const struct bfd_link_info *info)
    829 {
    830   return (struct elf_link_hash_table *) info->hash;
    831 }
    832 
    833 static inline enum elf_target_id
    834 elf_hash_table_id (const struct elf_link_hash_table *table)
    835 {
    836   return table->hash_table_id;
    837 }
    838 
    839 /* Constant information held for an ELF backend.  */
    841 
    842 struct elf_size_info {
    843   unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;
    844   unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;
    845 
    846   /* The size of entries in the .hash section.  */
    847   unsigned char sizeof_hash_entry;
    848 
    849   /* The number of internal relocations to allocate per external
    850      relocation entry.  */
    851   unsigned char int_rels_per_ext_rel;
    852   /* We use some fixed size arrays.  This should be large enough to
    853      handle all back-ends.  */
    854 #define MAX_INT_RELS_PER_EXT_REL 3
    855 
    856   unsigned char arch_size, log_file_align;
    857   unsigned char elfclass, ev_current;
    858   int (*write_out_phdrs)
    859     (bfd *, const Elf_Internal_Phdr *, unsigned int);
    860   bool (*write_shdrs_and_ehdr) (bfd *);
    861   bool (*checksum_contents)
    862     (bfd * , void (*) (const void *, size_t, void *), void *);
    863   void (*write_relocs)
    864     (bfd *, asection *, void *);
    865   bool (*swap_symbol_in)
    866     (bfd *, const void *, const void *, Elf_Internal_Sym *);
    867   void (*swap_symbol_out)
    868     (bfd *, const Elf_Internal_Sym *, void *, void *);
    869   bool (*slurp_reloc_table)
    870     (bfd *, asection *, asymbol **, bool);
    871   long (*slurp_symbol_table)
    872     (bfd *, asymbol **, bool);
    873   void (*swap_dyn_in)
    874     (bfd *, const void *, Elf_Internal_Dyn *);
    875   void (*swap_dyn_out)
    876     (bfd *, const Elf_Internal_Dyn *, void *);
    877 
    878   /* This function is called to swap in a REL relocation.  If an
    879      external relocation corresponds to more than one internal
    880      relocation, then all relocations are swapped in at once.  */
    881   void (*swap_reloc_in)
    882     (bfd *, const bfd_byte *, Elf_Internal_Rela *);
    883 
    884   /* This function is called to swap out a REL relocation.  */
    885   void (*swap_reloc_out)
    886     (bfd *, const Elf_Internal_Rela *, bfd_byte *);
    887 
    888   /* This function is called to swap in a RELA relocation.  If an
    889      external relocation corresponds to more than one internal
    890      relocation, then all relocations are swapped in at once.  */
    891   void (*swap_reloca_in)
    892     (bfd *, const bfd_byte *, Elf_Internal_Rela *);
    893 
    894   /* This function is called to swap out a RELA relocation.  */
    895   void (*swap_reloca_out)
    896     (bfd *, const Elf_Internal_Rela *, bfd_byte *);
    897 };
    898 
    899 #define elf_symbol_from(S) \
    900   ((((S)->flags & BSF_SYNTHETIC) == 0				\
    901     && (S)->the_bfd != NULL					\
    902     && (S)->the_bfd->xvec->flavour == bfd_target_elf_flavour	\
    903     && (S)->the_bfd->tdata.elf_obj_data != 0)			\
    904    ? (elf_symbol_type *) (S)					\
    905    : 0)
    906 
    907 enum elf_reloc_type_class {
    908   reloc_class_normal,
    909   reloc_class_relative,
    910   reloc_class_copy,
    911   reloc_class_ifunc,
    912   reloc_class_plt
    913 };
    914 
    915 struct elf_reloc_cookie
    916 {
    917   bfd *abfd;
    918   Elf_Internal_Rela *rels, *rel, *relend;
    919   /* Number of symbols in .symtab.  */
    920   unsigned int num_sym;
    921   /* Number of symbols that may be local syms (all when bad_symtab).  */
    922   unsigned int locsymcount;
    923   /* Symbol index of first possible global sym (0 when bad_symtab).  */
    924   unsigned int extsymoff;
    925   int r_sym_shift;
    926 };
    927 
    928 /* The level of IRIX compatibility we're striving for.  */
    929 
    930 typedef enum {
    931   ict_none,
    932   ict_irix5,
    933   ict_irix6
    934 } irix_compat_t;
    935 
    936 /* Mapping of ELF section names and types.  */
    937 struct bfd_elf_special_section
    938 {
    939   const char *prefix;
    940   unsigned int prefix_length;
    941   /* 0 means name must match PREFIX exactly.
    942      -1 means name must start with PREFIX followed by an arbitrary string.
    943      -2 means name must match PREFIX exactly or consist of PREFIX followed
    944      by a dot then anything.
    945      > 0 means name must start with the first PREFIX_LENGTH chars of
    946      PREFIX and finish with the last SUFFIX_LENGTH chars of PREFIX.  */
    947   signed int suffix_length;
    948   unsigned int type;
    949   bfd_vma attr;
    950 };
    951 
    952 enum action_discarded
    953   {
    954     COMPLAIN = 1,
    955     PRETEND = 2
    956   };
    957 
    958 typedef asection * (*elf_gc_mark_hook_fn)
    959   (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
    960    struct elf_link_hash_entry *, unsigned int);
    961 
    962 enum elf_property_kind
    963  {
    964     /* A new property.  */
    965     property_unknown = 0,
    966     /* A property ignored by backend.  */
    967     property_ignored,
    968     /* A corrupt property reported by backend.  */
    969     property_corrupt,
    970     /* A property should be removed due to property merge.  */
    971     property_remove,
    972     /* A property which is a number.  */
    973     property_number
    974  };
    975 
    976 typedef struct elf_property
    977 {
    978   unsigned int pr_type;
    979   unsigned int pr_datasz;
    980   union
    981     {
    982       /* For property_number, this is a number.  */
    983       bfd_vma number;
    984       /* Add a new one if elf_property_kind is updated.  */
    985     } u;
    986   enum elf_property_kind pr_kind;
    987 } elf_property;
    988 
    989 typedef struct elf_property_list
    990 {
    991   struct elf_property_list *next;
    992   struct elf_property property;
    993 } elf_property_list;
    994 
    995 /* This structure is used to pass information to
    996    elf_backend_add_glibc_version_dependency.  */
    997 
    998 struct elf_find_verdep_info
    999 {
   1000   /* General link information.  */
   1001   struct bfd_link_info *info;
   1002   /* The number of dependencies.  */
   1003   unsigned int vers;
   1004   /* Whether we had a failure.  */
   1005   bool failed;
   1006 };
   1007 
   1008 struct bfd_elf_section_reloc_data;
   1009 
   1010 struct elf_backend_data
   1011 {
   1012   /* The architecture for this backend.  */
   1013   ENUM_BITFIELD (bfd_architecture) arch : 8;
   1014 
   1015   /* EI_OSABI.  */
   1016   unsigned elf_osabi : 8;
   1017 
   1018   /* The ELF machine code (EM_xxxx) for this backend.  */
   1019   unsigned elf_machine_code : 16;
   1020 
   1021   /* An identifier used to distinguish different target specific
   1022      extensions to elf_obj_tdata and elf_link_hash_table structures.  */
   1023   ENUM_BITFIELD (elf_target_id) target_id : 8;
   1024 
   1025   /* Target OS.  */
   1026   ENUM_BITFIELD (elf_target_os) target_os : 2;
   1027 
   1028   /* True if object files must have exactly matching osabi.  False if
   1029      other osabi values are allowed.  */
   1030   unsigned osabi_exact : 1;
   1031 
   1032   /* The maximum page size for this backend.  */
   1033   unsigned maxpagesize;
   1034 
   1035   /* The minimum page size for this backend.  An input object will not be
   1036      considered page aligned unless its sections are correctly aligned for
   1037      pages at least this large.  May be smaller than maxpagesize.  */
   1038   unsigned minpagesize;
   1039 
   1040   /* The common page size for this backend.  */
   1041   unsigned commonpagesize;
   1042 
   1043   /* The p_align value for this backend.  If it is set, p_align of
   1044       PT_LOAD alignment will be to p_align by default.  */
   1045   unsigned p_align;
   1046 
   1047   /* The BFD flags applied to sections created for dynamic linking.  */
   1048   flagword dynamic_sec_flags;
   1049 
   1050   /* Architecture-specific data for this backend.
   1051      This is actually a pointer to some type like struct elf_ARCH_data.  */
   1052   const void *arch_data;
   1053 
   1054   /* A function to translate an ELF RELA relocation to a BFD arelent
   1055      structure.  Returns TRUE upon success, FALSE otherwise.  */
   1056   bool (*elf_info_to_howto)
   1057     (bfd *, arelent *, Elf_Internal_Rela *);
   1058 
   1059   /* A function to translate an ELF REL relocation to a BFD arelent
   1060      structure.  Returns TRUE upon success, FALSE otherwise.  */
   1061   bool (*elf_info_to_howto_rel)
   1062     (bfd *, arelent *, Elf_Internal_Rela *);
   1063 
   1064   /* A function to determine whether a symbol is global when
   1065      partitioning the symbol table into local and global symbols.
   1066      This should be NULL for most targets, in which case the correct
   1067      thing will be done.  MIPS ELF, at least on the Irix 5, has
   1068      special requirements.  */
   1069   bool (*elf_backend_sym_is_global)
   1070     (bfd *, asymbol *);
   1071 
   1072   /* The remaining functions are hooks which are called only if they
   1073      are not NULL.  */
   1074 
   1075   /* A function to permit a backend specific check on whether a
   1076      particular BFD format is relevant for an object file, and to
   1077      permit the backend to set any global information it wishes.  When
   1078      this is called elf_elfheader is set, but anything else should be
   1079      used with caution.  If this returns FALSE, the check_format
   1080      routine will return a bfd_error_wrong_format error.  */
   1081   bool (*elf_backend_object_p)
   1082     (bfd *);
   1083 
   1084   /* A function to do additional symbol processing when reading the
   1085      ELF symbol table.  This is where any processor-specific special
   1086      section indices are handled.  */
   1087   void (*elf_backend_symbol_processing)
   1088     (bfd *, asymbol *);
   1089 
   1090   /* A function to do additional symbol processing after reading the
   1091      entire ELF symbol table.  */
   1092   bool (*elf_backend_symbol_table_processing)
   1093     (bfd *, elf_symbol_type *, unsigned int);
   1094 
   1095   /* A function to set the type of the info field.  Processor-specific
   1096      types should be handled here.  */
   1097   int (*elf_backend_get_symbol_type)
   1098     (Elf_Internal_Sym *, int);
   1099 
   1100   /* A function to return the linker hash table entry of a symbol that
   1101      might be satisfied by an archive symbol.  */
   1102   struct bfd_link_hash_entry * (*elf_backend_archive_symbol_lookup)
   1103     (bfd *, struct bfd_link_info *, const char *);
   1104 
   1105   /* Return true if local section symbols should have a non-null st_name.
   1106      NULL implies false.  */
   1107   bool (*elf_backend_name_local_section_symbols)
   1108     (bfd *);
   1109 
   1110   /* A function to do additional processing on the ELF section header
   1111      just before writing it out.  This is used to set the flags and
   1112      type fields for some sections, or to actually write out data for
   1113      unusual sections.  */
   1114   bool (*elf_backend_section_processing)
   1115     (bfd *, Elf_Internal_Shdr *);
   1116 
   1117   /* A function to handle unusual section types when creating BFD
   1118      sections from ELF sections.  */
   1119   bool (*elf_backend_section_from_shdr)
   1120     (bfd *, Elf_Internal_Shdr *, const char *, int);
   1121 
   1122   /* A function to convert machine dependent ELF section header flags to
   1123      BFD internal section header flags.  */
   1124   bool (*elf_backend_section_flags)
   1125     (const Elf_Internal_Shdr *);
   1126 
   1127   /* A function that returns a struct containing ELF section flags and
   1128      type for the given BFD section.   */
   1129   const struct bfd_elf_special_section * (*get_sec_type_attr)
   1130     (bfd *, asection *);
   1131 
   1132   /* A function to handle unusual program segment types when creating BFD
   1133      sections from ELF program segments.  */
   1134   bool (*elf_backend_section_from_phdr)
   1135     (bfd *, Elf_Internal_Phdr *, int, const char *);
   1136 
   1137   /* A function to set up the ELF section header for a BFD section in
   1138      preparation for writing it out.  This is where the flags and type
   1139      fields are set for unusual sections.  */
   1140   bool (*elf_backend_fake_sections)
   1141     (bfd *, Elf_Internal_Shdr *, asection *);
   1142 
   1143   /* A function to get the ELF section index for a BFD section.  If
   1144      this returns TRUE, the section was found.  If it is a normal ELF
   1145      section, *RETVAL should be left unchanged.  If it is not a normal
   1146      ELF section *RETVAL should be set to the SHN_xxxx index.  */
   1147   bool (*elf_backend_section_from_bfd_section)
   1148     (bfd *, asection *, int *retval);
   1149 
   1150   /* If this field is not NULL, it is called by the add_symbols phase
   1151      of a link just before adding a symbol to the global linker hash
   1152      table.  It may modify any of the fields as it wishes.  If *NAME
   1153      is set to NULL, the symbol will be skipped rather than being
   1154      added to the hash table.  This function is responsible for
   1155      handling all processor dependent symbol bindings and section
   1156      indices, and must set at least *FLAGS and *SEC for each processor
   1157      dependent case; failure to do so will cause a link error.  */
   1158   bool (*elf_add_symbol_hook)
   1159     (bfd *abfd, struct bfd_link_info *info, Elf_Internal_Sym *,
   1160      const char **name, flagword *flags, asection **sec, bfd_vma *value);
   1161 
   1162   /* If this field is not NULL, it is called by the elf_link_output_sym
   1163      phase of a link for each symbol which will appear in the object file.
   1164      On error, this function returns 0.  1 is returned when the symbol
   1165      should be output, 2 is returned when the symbol should be discarded.  */
   1166   int (*elf_backend_link_output_symbol_hook)
   1167     (struct bfd_link_info *info, const char *, Elf_Internal_Sym *,
   1168      asection *, struct elf_link_hash_entry *);
   1169 
   1170   /* The CREATE_DYNAMIC_SECTIONS function is called by the ELF backend
   1171      linker the first time it encounters a dynamic object in the link.
   1172      This function must create any sections required for dynamic
   1173      linking.  The ABFD argument is a dynamic object.  The .interp,
   1174      .dynamic, .dynsym, .dynstr, and .hash functions have already been
   1175      created, and this function may modify the section flags if
   1176      desired.  This function will normally create the .got and .plt
   1177      sections, but different backends have different requirements.  */
   1178   bool (*elf_backend_create_dynamic_sections)
   1179     (bfd *abfd, struct bfd_link_info *info);
   1180 
   1181   /* When creating a shared library, determine whether to omit the
   1182      dynamic symbol for the section.  */
   1183   bool (*elf_backend_omit_section_dynsym)
   1184     (bfd *output_bfd, struct bfd_link_info *info, asection *osec);
   1185 
   1186   /* Return TRUE if relocations of targets are compatible to the extent
   1187      that CHECK_RELOCS will properly process them.  PR 4424.  */
   1188   bool (*relocs_compatible) (const bfd_target *, const bfd_target *);
   1189 
   1190   /* The CHECK_RELOCS function is called after all input files have been
   1191      opened.  It is called once for each section with relocs of an object
   1192      file.  The function must look through the relocs and do any special
   1193      handling required.  This generally means allocating space in the
   1194      global offset table, and perhaps allocating space for a reloc.  The
   1195      relocs are always passed as Rela structures; if the section
   1196      actually uses Rel structures, the r_addend field will always be
   1197      zero.  */
   1198   bool (*check_relocs)
   1199     (bfd *abfd, struct bfd_link_info *info, asection *o,
   1200      const Elf_Internal_Rela *relocs);
   1201 
   1202   /* The SIZE_RELATIVE_RELOCS function is called to size relative
   1203      relocations when mappig sections to segments.  */
   1204   bool (*size_relative_relocs)
   1205     (struct bfd_link_info *info, bool *need_layout);
   1206 
   1207   /* The FINISH_RELATIVE_RELOCS function is called to finish relative
   1208      relocations in bfd_elf_final_link.  */
   1209   bool (*finish_relative_relocs)
   1210     (struct bfd_link_info *info);
   1211 
   1212   /* The CHECK_DIRECTIVES function is called once per input file by
   1213      the add_symbols phase of the ELF backend linker.  The function
   1214      must inspect the bfd and create any additional symbols according
   1215      to any custom directives in the bfd.  */
   1216   bool (*check_directives)
   1217     (bfd *abfd, struct bfd_link_info *info);
   1218 
   1219   /* The NOTICE_AS_NEEDED function is called as the linker is about to
   1220      handle an as-needed lib (ACT = notice_as_needed), and after the
   1221      linker has decided to keep the lib (ACT = notice_needed) or when
   1222      the lib is not needed (ACT = notice_not_needed).  */
   1223   bool (*notice_as_needed)
   1224     (bfd *abfd, struct bfd_link_info *info, enum notice_asneeded_action act);
   1225 
   1226   /* The ADJUST_DYNAMIC_SYMBOL function is called by the ELF backend
   1227      linker for every symbol which is defined by a dynamic object and
   1228      referenced by a regular object.  This is called after all the
   1229      input files have been seen, but before the LATE_SIZE_SECTIONS
   1230      function has been called.  The hash table entry should be
   1231      bfd_link_hash_defined ore bfd_link_hash_defweak, and it should be
   1232      defined in a section from a dynamic object.  Dynamic object
   1233      sections are not included in the final link, and this function is
   1234      responsible for changing the value to something which the rest of
   1235      the link can deal with.  This will normally involve adding an
   1236      entry to the .plt or .got or some such section, and setting the
   1237      symbol to point to that.  */
   1238   bool (*elf_backend_adjust_dynamic_symbol)
   1239     (struct bfd_link_info *info, struct elf_link_hash_entry *h);
   1240 
   1241   /* The EARLY_SIZE_SECTIONS and LATE_SIZE_SECTIONS functions are
   1242      called by the backend linker after all linker input files have
   1243      been seen and sections have been assigned to output sections, but
   1244      before the section sizes have been set.  Both of these functions
   1245      are called even when no dynamic object is seen by the linker.
   1246      Between them, they must set the sizes of the dynamic sections and
   1247      other backend specific sections, and may fill in their contents.
   1248      Most backends need only use LATE_SIZE_SECTIONS.
   1249      EARLY_SIZE_SECTIONS is called before --export-dynamic makes some
   1250      symbols dynamic and before ADJUST_DYNAMIC_SYMBOL processes
   1251      dynamic symbols, LATE_SIZE_SECTIONS afterwards.  The generic ELF
   1252      linker can handle the .dynsym, .dynstr and .hash sections.
   1253      Besides those, these functions must handle the .interp section
   1254      and any other sections created by CREATE_DYNAMIC_SECTIONS.  */
   1255   bool (*elf_backend_early_size_sections)
   1256     (bfd *output_bfd, struct bfd_link_info *info);
   1257   bool (*elf_backend_late_size_sections)
   1258     (bfd *output_bfd, struct bfd_link_info *info);
   1259 
   1260   /* The STRIP_ZERO_SIZED_DYNAMIC_SECTIONS function is called by the
   1261      ELF backend linker to strip zero-sized dynamic sections after
   1262      the section sizes have been set.  */
   1263   bool (*elf_backend_strip_zero_sized_dynamic_sections)
   1264     (struct bfd_link_info *info);
   1265 
   1266   /* Set TEXT_INDEX_SECTION and DATA_INDEX_SECTION, the output sections
   1267      we keep to use as a base for relocs and symbols.  */
   1268   void (*elf_backend_init_index_section)
   1269     (bfd *output_bfd, struct bfd_link_info *info);
   1270 
   1271   /* The RELOCATE_SECTION function is called by the ELF backend linker
   1272      to handle the relocations for a section.
   1273 
   1274      The relocs are always passed as Rela structures; if the section
   1275      actually uses Rel structures, the r_addend field will always be
   1276      zero.
   1277 
   1278      This function is responsible for adjust the section contents as
   1279      necessary, and (if using Rela relocs and generating a
   1280      relocatable output file) adjusting the reloc addend as
   1281      necessary.
   1282 
   1283      This function does not have to worry about setting the reloc
   1284      address or the reloc symbol index.
   1285 
   1286      LOCAL_SYMS is a pointer to the swapped in local symbols.
   1287 
   1288      LOCAL_SECTIONS is an array giving the section in the input file
   1289      corresponding to the st_shndx field of each local symbol.
   1290 
   1291      The global hash table entry for the global symbols can be found
   1292      via elf_sym_hashes (input_bfd).
   1293 
   1294      When generating relocatable output, this function must handle
   1295      STB_LOCAL/STT_SECTION symbols specially.  The output symbol is
   1296      going to be the section symbol corresponding to the output
   1297      section, which means that the addend must be adjusted
   1298      accordingly.
   1299 
   1300      Returns FALSE on error, TRUE on success, 2 if successful and
   1301      relocations should be written for this section.  */
   1302   int (*elf_backend_relocate_section)
   1303     (bfd *output_bfd, struct bfd_link_info *info, bfd *input_bfd,
   1304      asection *input_section, bfd_byte *contents, Elf_Internal_Rela *relocs,
   1305      Elf_Internal_Sym *local_syms, asection **local_sections);
   1306 
   1307   /* The FINISH_DYNAMIC_SYMBOL function is called by the ELF backend
   1308      linker just before it writes a symbol out to the .dynsym section.
   1309      The processor backend may make any required adjustment to the
   1310      symbol.  It may also take the opportunity to set contents of the
   1311      dynamic sections.  Note that FINISH_DYNAMIC_SYMBOL is called on
   1312      all .dynsym symbols, while ADJUST_DYNAMIC_SYMBOL is only called
   1313      on those symbols which are defined by a dynamic object.  */
   1314   bool (*elf_backend_finish_dynamic_symbol)
   1315     (bfd *output_bfd, struct bfd_link_info *info,
   1316      struct elf_link_hash_entry *h, Elf_Internal_Sym *sym);
   1317 
   1318   /* The FINISH_DYNAMIC_SECTIONS function is called by the ELF backend
   1319      linker just before it writes all the dynamic sections out to the
   1320      output file.  The FINISH_DYNAMIC_SYMBOL will have been called on
   1321      all dynamic symbols.  */
   1322   bool (*elf_backend_finish_dynamic_sections)
   1323     (bfd *output_bfd, struct bfd_link_info *info, bfd_byte *);
   1324 
   1325   /* A function to do any beginning processing needed for the ELF file
   1326      before building the ELF headers and computing file positions.  */
   1327   void (*elf_backend_begin_write_processing)
   1328     (bfd *, struct bfd_link_info *);
   1329 
   1330   /* A function to do any final processing needed for the ELF file
   1331      before writing it out.  */
   1332   bool (*elf_backend_final_write_processing)
   1333     (bfd *);
   1334 
   1335   /* This function is called by get_program_header_size.  It should
   1336      return the number of additional program segments which this BFD
   1337      will need.  It should return -1 on error.  */
   1338   int (*elf_backend_additional_program_headers)
   1339     (bfd *, struct bfd_link_info *);
   1340 
   1341   /* This function is called to modify an existing segment map in a
   1342      backend specific fashion.  */
   1343   bool (*elf_backend_modify_segment_map)
   1344     (bfd *, struct bfd_link_info *);
   1345 
   1346   /* This function is called to modify program headers just before
   1347      they are written.  */
   1348   bool (*elf_backend_modify_headers)
   1349     (bfd *, struct bfd_link_info *);
   1350 
   1351   /* This function is called to see if the PHDR header should be
   1352      checked for validity.  */
   1353   bool (*elf_backend_allow_non_load_phdr)
   1354     (bfd *,  const Elf_Internal_Phdr *, unsigned);
   1355 
   1356   /* This function is called before section garbage collection to
   1357      mark entry symbol sections.  */
   1358   void (*gc_keep)
   1359     (struct bfd_link_info *);
   1360 
   1361   /* This function is called during section garbage collection to
   1362      mark sections that define global symbols.  */
   1363   bool (*gc_mark_dynamic_ref)
   1364     (struct elf_link_hash_entry *, void *);
   1365 
   1366   /* This function is called during section gc to discover the section a
   1367      particular relocation refers to.  */
   1368   elf_gc_mark_hook_fn gc_mark_hook;
   1369 
   1370   /* This function, if defined, is called after the first gc marking pass
   1371      to allow the backend to mark additional sections.  */
   1372   bool (*gc_mark_extra_sections)
   1373     (struct bfd_link_info *, elf_gc_mark_hook_fn);
   1374 
   1375   /* This function is called to initialise ELF file header info.
   1376      Customised versions can modify things like the OS and ABI version.  */
   1377   bool (*elf_backend_init_file_header)
   1378     (bfd *, struct bfd_link_info *);
   1379 
   1380   /* This function, if defined, prints a symbol to file and returns the
   1381      name of the symbol to be printed.  It should return NULL to fall
   1382      back to default symbol printing.  */
   1383   const char *(*elf_backend_print_symbol_all)
   1384     (bfd *, void *, asymbol *);
   1385 
   1386   /* This function, if defined, is called after all local symbols and
   1387      global symbols converted to locals are emitted into the symtab
   1388      section.  It allows the backend to emit special local symbols
   1389      not handled in the hash table.  */
   1390   bool (*elf_backend_output_arch_local_syms)
   1391     (bfd *, struct bfd_link_info *, void *,
   1392      int (*) (void *, const char *, Elf_Internal_Sym *, asection *,
   1393 	      struct elf_link_hash_entry *));
   1394 
   1395   /* This function, if defined, is called after all symbols are emitted
   1396      into the symtab section.  It allows the backend to emit special
   1397      global symbols not handled in the hash table.  */
   1398   bool (*elf_backend_output_arch_syms)
   1399     (bfd *, struct bfd_link_info *, void *,
   1400      int (*) (void *, const char *, Elf_Internal_Sym *, asection *,
   1401 	      struct elf_link_hash_entry *));
   1402 
   1403   /* Filter what symbols of the output file to include in the import
   1404      library if one is created.  */
   1405   unsigned int (*elf_backend_filter_implib_symbols)
   1406     (bfd *, struct bfd_link_info *, asymbol **, long);
   1407 
   1408   /* Copy any information related to dynamic linking from a pre-existing
   1409      symbol to a newly created symbol.  Also called to copy flags and
   1410      other back-end info to a weakdef, in which case the symbol is not
   1411      newly created and plt/got refcounts and dynamic indices should not
   1412      be copied.  */
   1413   void (*elf_backend_copy_indirect_symbol)
   1414     (struct bfd_link_info *, struct elf_link_hash_entry *,
   1415      struct elf_link_hash_entry *);
   1416 
   1417   /* Modify any information related to dynamic linking such that the
   1418      symbol is not exported.  */
   1419   void (*elf_backend_hide_symbol)
   1420     (struct bfd_link_info *, struct elf_link_hash_entry *, bool);
   1421 
   1422   /* A function to do additional symbol fixup, called by
   1423      _bfd_elf_fix_symbol_flags.  */
   1424   bool (*elf_backend_fixup_symbol)
   1425     (struct bfd_link_info *, struct elf_link_hash_entry *);
   1426 
   1427   /* Merge the backend specific symbol attribute.  */
   1428   void (*elf_backend_merge_symbol_attribute)
   1429     (struct elf_link_hash_entry *, unsigned int, bool, bool);
   1430 
   1431   /* This function, if defined, will return a string containing the
   1432      name of a target-specific dynamic tag.  */
   1433   char *(*elf_backend_get_target_dtag)
   1434     (bfd_vma);
   1435 
   1436   /* Decide whether an undefined symbol is special and can be ignored.
   1437      This is the case for OPTIONAL symbols on IRIX.  */
   1438   bool (*elf_backend_ignore_undef_symbol)
   1439     (struct elf_link_hash_entry *);
   1440 
   1441   /* Emit relocations.  Overrides default routine for emitting relocs,
   1442      except during a relocatable link, or if all relocs are being emitted.  */
   1443   bool (*elf_backend_emit_relocs)
   1444     (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
   1445      struct elf_link_hash_entry **);
   1446 
   1447   /* Update relocations.  It is allowed to change the number and the order.
   1448      In such a case hashes should be invalidated.  */
   1449   void (*elf_backend_update_relocs)
   1450     (asection *, struct bfd_elf_section_reloc_data *);
   1451 
   1452   /* Count relocations.  Not called for relocatable links
   1453      or if all relocs are being preserved in the output.  */
   1454   unsigned int (*elf_backend_count_relocs)
   1455     (struct bfd_link_info *, asection *);
   1456 
   1457   /* Count additionals relocations.  Called for relocatable links if
   1458      additional relocations needs to be created.  */
   1459   unsigned int (*elf_backend_count_additional_relocs)
   1460     (asection *);
   1461 
   1462   /* Say whether to sort relocs output by ld -r and ld --emit-relocs,
   1463      by r_offset.  If NULL, default to true.  */
   1464   bool (*sort_relocs_p)
   1465     (asection *);
   1466 
   1467   /* This function, if defined, is called when an NT_PRSTATUS note is found
   1468      in a core file.  */
   1469   bool (*elf_backend_grok_prstatus)
   1470     (bfd *, Elf_Internal_Note *);
   1471 
   1472   /* This function, if defined, is called when an NT_PSINFO or NT_PRPSINFO
   1473      note is found in a core file.  */
   1474   bool (*elf_backend_grok_psinfo)
   1475     (bfd *, Elf_Internal_Note *);
   1476 
   1477   /* This function, if defined, is called when a "FreeBSD" NT_PRSTATUS
   1478      note is found in a core file.  */
   1479   bool (*elf_backend_grok_freebsd_prstatus)
   1480     (bfd *, Elf_Internal_Note *);
   1481 
   1482   /* This function, if defined, is called to write a note to a corefile.  */
   1483   char *(*elf_backend_write_core_note)
   1484     (bfd *abfd, char *buf, int *bufsiz, int note_type, ...);
   1485 
   1486   /* This function, if defined, is called to convert target-specific
   1487      section flag names into hex values.  */
   1488   flagword (*elf_backend_lookup_section_flags_hook)
   1489     (char *);
   1490 
   1491   /* This function returns class of a reloc type.  */
   1492   enum elf_reloc_type_class (*elf_backend_reloc_type_class)
   1493   (const struct bfd_link_info *, const asection *, const Elf_Internal_Rela *);
   1494 
   1495   /* This function, if defined, removes information about discarded functions
   1496      from other sections which mention them.  */
   1497   bool (*elf_backend_discard_info)
   1498     (bfd *, struct elf_reloc_cookie *, struct bfd_link_info *);
   1499 
   1500   /* This function, if defined, signals that the function above has removed
   1501      the discarded relocations for this section.  */
   1502   bool (*elf_backend_ignore_discarded_relocs)
   1503     (asection *);
   1504 
   1505   /* What to do when ld finds relocations against symbols defined in
   1506      discarded sections.  */
   1507   unsigned int (*action_discarded)
   1508     (asection *);
   1509 
   1510   /* This function returns the width of FDE pointers in bytes, or 0 if
   1511      that can't be determined for some reason.  The default definition
   1512      goes by the bfd's EI_CLASS.  */
   1513   unsigned int (*elf_backend_eh_frame_address_size)
   1514     (bfd *, const asection *);
   1515 
   1516   /* These functions tell elf-eh-frame whether to attempt to turn
   1517      absolute or lsda encodings into pc-relative ones.  The default
   1518      definition enables these transformations.  */
   1519   bool (*elf_backend_can_make_relative_eh_frame)
   1520      (bfd *, struct bfd_link_info *, asection *);
   1521   bool (*elf_backend_can_make_lsda_relative_eh_frame)
   1522      (bfd *, struct bfd_link_info *, asection *);
   1523 
   1524   /* This function returns an encoding after computing the encoded
   1525      value (and storing it in ENCODED) for the given OFFSET into OSEC,
   1526      to be stored in at LOC_OFFSET into the LOC_SEC input section.
   1527      The default definition chooses a 32-bit PC-relative encoding.  */
   1528   bfd_byte (*elf_backend_encode_eh_address)
   1529      (bfd *abfd, struct bfd_link_info *info,
   1530       asection *osec, bfd_vma offset,
   1531       asection *loc_sec, bfd_vma loc_offset,
   1532       bfd_vma *encoded);
   1533 
   1534   /* This function, if defined, may write out the given section.
   1535      Returns TRUE if it did so and FALSE if the caller should.  */
   1536   bool (*elf_backend_write_section)
   1537     (bfd *, struct bfd_link_info *, asection *, bfd_byte *);
   1538 
   1539   /* This function adds glibc version dependency.  */
   1540   void (*elf_backend_add_glibc_version_dependency)
   1541     (struct elf_find_verdep_info *);
   1542 
   1543   /* This function, if defined, returns TRUE if it is section symbols
   1544      only that are considered local for the purpose of partitioning the
   1545      symbol table into local and global symbols.  This should be NULL
   1546      for most targets, in which case the correct thing will be done.
   1547      MIPS ELF, at least on the Irix 5, has special requirements.  */
   1548   bool (*elf_backend_elfsym_local_is_section)
   1549     (bfd *);
   1550 
   1551   /* The level of IRIX compatibility we're striving for.
   1552      MIPS ELF specific function.  */
   1553   irix_compat_t (*elf_backend_mips_irix_compat)
   1554     (bfd *);
   1555 
   1556   reloc_howto_type *(*elf_backend_mips_rtype_to_howto)
   1557     (bfd *, unsigned int, bool);
   1558 
   1559   /* The swapping table to use when dealing with ECOFF information.
   1560      Used for the MIPS ELF .mdebug section.  */
   1561   const struct ecoff_debug_swap *elf_backend_ecoff_debug_swap;
   1562 
   1563   /* This function implements `bfd_elf_bfd_from_remote_memory';
   1564      see elf.c, elfcode.h.  */
   1565   bfd *(*elf_backend_bfd_from_remote_memory)
   1566     (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
   1567      int (*target_read_memory) (bfd_vma vma, bfd_byte *myaddr,
   1568 				bfd_size_type len));
   1569 
   1570   bool (*elf_backend_core_find_build_id) (bfd *, bfd_vma);
   1571 
   1572   /* This function is used by `_bfd_elf_get_synthetic_symtab';
   1573      see elf.c.  */
   1574   bfd_vma (*plt_sym_val) (bfd_vma, const asection *, const arelent *);
   1575 
   1576   /* Is symbol defined in common section?  */
   1577   bool (*common_definition) (Elf_Internal_Sym *);
   1578 
   1579   /* Return a common section index for section.  */
   1580   unsigned int (*common_section_index) (asection *);
   1581 
   1582   /* Return a common section for section.  */
   1583   asection *(*common_section) (asection *);
   1584 
   1585   /* Return TRUE if we can merge 2 definitions.  */
   1586   bool (*merge_symbol) (struct elf_link_hash_entry *,
   1587 			       const Elf_Internal_Sym *, asection **,
   1588 			       bool, bool,
   1589 			       bfd *, const asection *);
   1590 
   1591   /* Return TRUE if symbol should be hashed in the `.gnu.hash' section.  */
   1592   bool (*elf_hash_symbol) (struct elf_link_hash_entry *);
   1593 
   1594   /* If non-NULL, called to register the location of XLAT_LOC within
   1595      .MIPS.xhash at which real final dynindx for H will be written.
   1596      If XLAT_LOC is zero, the symbol is not included in
   1597      .MIPS.xhash and no dynindx will be written.  */
   1598   void (*record_xhash_symbol)
   1599     (struct elf_link_hash_entry *h, bfd_vma xlat_loc);
   1600 
   1601   /* Return TRUE if type is a function symbol type.  */
   1602   bool (*is_function_type) (unsigned int type);
   1603 
   1604   /* If the ELF symbol SYM might be a function in SEC, return the
   1605      function size and set *CODE_OFF to the function's entry point,
   1606      otherwise return zero.  */
   1607   bfd_size_type (*maybe_function_sym) (const asymbol *sym, asection *sec,
   1608 				       bfd_vma *code_off);
   1609 
   1610   /* Given NAME, the name of a relocation section stripped of its
   1611      .rel/.rela prefix, return the section in ABFD to which the
   1612      relocations apply.  */
   1613   asection *(*get_reloc_section) (bfd *abfd, const char *name);
   1614 
   1615   /* Called to set the sh_flags, sh_link and sh_info fields of OSECTION which
   1616      has a type >= SHT_LOOS.  Returns TRUE if the fields were initialised,
   1617      FALSE otherwise.  Can be called multiple times for a given section,
   1618      until it returns TRUE.  Most of the times it is called ISECTION will be
   1619      set to an input section that might be associated with the output section.
   1620      The last time that it is called, ISECTION will be set to NULL.  */
   1621   bool (*elf_backend_copy_special_section_fields)
   1622     (const bfd *ibfd, bfd *obfd, const Elf_Internal_Shdr *isection,
   1623      Elf_Internal_Shdr *osection);
   1624 
   1625   /* Used to handle bad SHF_LINK_ORDER input.  */
   1626   void (*link_order_error_handler) (const char *, ...);
   1627 
   1628   /* Name of the PLT relocation section.  */
   1629   const char *relplt_name;
   1630 
   1631   /* Alternate EM_xxxx machine codes for this backend.  */
   1632   int elf_machine_alt1;
   1633   int elf_machine_alt2;
   1634 
   1635   const struct elf_size_info *s;
   1636 
   1637   /* An array of target specific special sections.  */
   1638   const struct bfd_elf_special_section *special_sections;
   1639 
   1640   /* The size in bytes of the header for the GOT.  This includes the
   1641      so-called reserved entries on some systems.  */
   1642   bfd_vma got_header_size;
   1643 
   1644   /* The size of the GOT entry for the symbol pointed to by H if non-NULL,
   1645      otherwise by the local symbol with index SYMNDX in IBFD.  */
   1646   bfd_vma (*got_elt_size) (bfd *, struct bfd_link_info *,
   1647 			   struct elf_link_hash_entry *h,
   1648 			   bfd *ibfd, unsigned long symndx);
   1649 
   1650   /* The vendor name to use for a processor-standard attributes section.  */
   1651   const char *obj_attrs_vendor;
   1652 
   1653   /* The section name to use for a processor-standard attributes section.  */
   1654   const char *obj_attrs_section;
   1655 
   1656   /* Return 1, 2 or 3 to indicate what type of arguments a tag takes.  */
   1657   int (*obj_attrs_arg_type) (obj_attr_tag_t);
   1658 
   1659   /* The section type to use for an attributes section.  */
   1660   unsigned int obj_attrs_section_type;
   1661 
   1662   /* The preferred version of object attributes for the output object.  */
   1663   obj_attr_version_t default_obj_attr_version;
   1664 
   1665   /* Decode the object attributes version from the version number encoded in
   1666      the input object.  */
   1667   obj_attr_version_t (*obj_attrs_version_dec) (uint8_t);
   1668 
   1669   /* Encode the object attributes version into the output object.  */
   1670   uint8_t (*obj_attrs_version_enc) (obj_attr_version_t);
   1671 
   1672   /* The known subsections and attributes (v2 only).  */
   1673   const known_subsection_v2_t *obj_attr_v2_known_subsections;
   1674 
   1675   /* The size of the array of known subsections.  */
   1676   const size_t obj_attr_v2_known_subsections_size;
   1677 
   1678   /* Translate GNU properties that have object attributes v2 equivalents.  */
   1679   void (*translate_gnu_props_to_obj_attrs) (const bfd *,
   1680     const elf_property_list *);
   1681 
   1682   /* Translate object attributes v2 that have GNU properties equivalents.  */
   1683   void (*translate_obj_attrs_to_gnu_props) (bfd *,
   1684     const obj_attr_subsection_v2_t *);
   1685 
   1686   /* Get default value for an attribute.  */
   1687   bool (*obj_attr_v2_default_value) (const struct bfd_link_info *,
   1688     const obj_attr_info_t *, const obj_attr_subsection_v2_t *, obj_attr_v2_t *);
   1689 
   1690   /* Merge a object attribute v2.  */
   1691   obj_attr_v2_merge_result_t (*obj_attr_v2_tag_merge)
   1692     (const struct bfd_link_info *, const bfd *, const obj_attr_subsection_v2_t *,
   1693      const obj_attr_v2_t *, const obj_attr_v2_t *, const obj_attr_v2_t *);
   1694 
   1695   /* This function determines the order in which any attributes are
   1696      written.  It must be defined for input in the range
   1697      LEAST_KNOWN_OBJ_ATTRIBUTE..NUM_KNOWN_OBJ_ATTRIBUTES-1 (this range
   1698      is used in order to make unity easy).  The returned value is the
   1699      actual tag number to place in the input position.  */
   1700   int (*obj_attrs_order) (int);
   1701 
   1702   /* Handle merging unknown attributes; either warn and return TRUE,
   1703      or give an error and return FALSE.  */
   1704   bool (*obj_attrs_handle_unknown) (bfd *, int);
   1705 
   1706   /* Parse GNU properties.  Return the property kind.  If the property
   1707      is corrupt, issue an error message and return property_corrupt.  */
   1708   enum elf_property_kind (*parse_gnu_properties) (bfd *, unsigned int,
   1709 						  bfd_byte *,
   1710 						  unsigned int);
   1711 
   1712   /* Merge GNU properties.  Return TRUE if property is updated.  */
   1713   bool (*merge_gnu_properties) (struct bfd_link_info *, bfd *, bfd *,
   1714 				       elf_property *, elf_property *);
   1715 
   1716   /* Set up object attributes.  */
   1717   bfd *(*setup_object_attributes) (struct bfd_link_info *);
   1718 
   1719   /* Set up GNU properties.  */
   1720   bfd *(*setup_gnu_properties) (struct bfd_link_info *);
   1721 
   1722   /* Fix up GNU properties.  */
   1723   void (*fixup_gnu_properties) (struct bfd_link_info *,
   1724 				elf_property_list **);
   1725 
   1726   /* Encoding used for compact EH tables.  */
   1727   int (*compact_eh_encoding) (struct bfd_link_info *);
   1728 
   1729   /* Opcode representing no unwind.  */
   1730   int (*cant_unwind_opcode) (struct bfd_link_info *);
   1731 
   1732   /* Called when emitting an ELF symbol whoes input version had an
   1733      ST_SHNDX field set to a value in the range SHN_LOPROC..SHN_HIOS.
   1734      Returns the value to be installed in the ST_SHNDX field of the
   1735      emitted symbol.  If not defined, the value is left unchanged.  */
   1736   unsigned int (*symbol_section_index) (bfd *, elf_symbol_type *);
   1737 
   1738   /* Called when a section has extra reloc sections.  */
   1739   bool (*init_secondary_reloc_section) (bfd *, Elf_Internal_Shdr *,
   1740 					const char *, unsigned int);
   1741 
   1742   /* Called when after loading the normal relocs for a section.  */
   1743   bool (*slurp_secondary_relocs) (bfd *, asection *, asymbol **, bool);
   1744 
   1745   /* Called after writing the normal relocs for a section.  */
   1746   bool (*write_secondary_relocs) (bfd *, asection *);
   1747 
   1748   /* This is non-zero if static TLS segments require a special alignment.  */
   1749   unsigned static_tls_alignment;
   1750 
   1751   /* Alignment for the PT_GNU_STACK segment.  */
   1752   unsigned stack_align;
   1753 
   1754   /* This is TRUE if the linker should act like collect and gather
   1755      global constructors and destructors by name.  This is TRUE for
   1756      MIPS ELF because the Irix 5 tools can not handle the .init
   1757      section.  */
   1758   unsigned collect : 1;
   1759 
   1760   /* This is TRUE if the linker should ignore changes to the type of a
   1761      symbol.  This is TRUE for MIPS ELF because some Irix 5 objects
   1762      record undefined functions as STT_OBJECT although the definitions
   1763      are STT_FUNC.  */
   1764   unsigned type_change_ok : 1;
   1765 
   1766   /* Whether the backend may use REL relocations.  (Some backends use
   1767      both REL and RELA relocations, and this flag is set for those
   1768      backends.)  */
   1769   unsigned may_use_rel_p : 1;
   1770 
   1771   /* Whether the backend may use RELA relocations.  (Some backends use
   1772      both REL and RELA relocations, and this flag is set for those
   1773      backends.)  */
   1774   unsigned may_use_rela_p : 1;
   1775 
   1776   /* Whether the default relocation type is RELA.  If a backend with
   1777      this flag set wants REL relocations for a particular section,
   1778      it must note that explicitly.  Similarly, if this flag is clear,
   1779      and the backend wants RELA relocations for a particular
   1780      section.  */
   1781   unsigned default_use_rela_p : 1;
   1782 
   1783   /* True if PLT and copy relocations should be RELA by default.  */
   1784   unsigned rela_plts_and_copies_p : 1;
   1785 
   1786   /* Set if RELA relocations for a relocatable link can be handled by
   1787      generic code.  Backends that set this flag need do nothing in the
   1788      backend relocate_section routine for relocatable linking.  */
   1789   unsigned rela_normal : 1;
   1790 
   1791   /* Set if DT_REL/DT_RELA/DT_RELSZ/DT_RELASZ should not include PLT
   1792      relocations.  */
   1793   unsigned dtrel_excludes_plt : 1;
   1794 
   1795   /* TRUE if addresses "naturally" sign extend.  This is used when
   1796      swapping in from Elf32 when BFD64.  */
   1797   unsigned sign_extend_vma : 1;
   1798 
   1799   unsigned want_got_plt : 1;
   1800   unsigned plt_readonly : 1;
   1801   unsigned want_plt_sym : 1;
   1802   unsigned plt_not_loaded : 1;
   1803   unsigned plt_alignment : 4;
   1804   unsigned can_gc_sections : 1;
   1805   unsigned can_refcount : 1;
   1806   unsigned want_got_sym : 1;
   1807   unsigned want_dynbss : 1;
   1808   unsigned want_dynrelro : 1;
   1809 
   1810   /* Targets which do not support physical addressing often require
   1811      that the p_paddr field in the section header to be set to zero.
   1812      This field indicates whether this behavior is required.  */
   1813   unsigned want_p_paddr_set_to_zero : 1;
   1814 
   1815   /* Target has broken hardware and/or kernel that requires pages not
   1816      to be mapped twice with different permissions.  */
   1817   unsigned no_page_alias : 1;
   1818 
   1819   /* True if an object file lacking a .note.GNU-stack section
   1820      should be assumed to be requesting exec stack.  At least one
   1821      other file in the link needs to have a .note.GNU-stack section
   1822      for a PT_GNU_STACK segment to be created.  */
   1823   unsigned default_execstack : 1;
   1824 
   1825   /* True if elf_section_data(sec)->this_hdr.contents is sec->rawsize
   1826      in length rather than sec->size in length, if sec->rawsize is
   1827      non-zero and smaller than sec->size.  */
   1828   unsigned caches_rawsize : 1;
   1829 
   1830   /* Address of protected data defined in the shared library may be
   1831      external, i.e., due to copy relocation.   */
   1832   unsigned extern_protected_data : 1;
   1833 
   1834   /* True if `_bfd_elf_link_renumber_dynsyms' must be called even for
   1835      static binaries.  */
   1836   unsigned always_renumber_dynsyms : 1;
   1837 
   1838   /* True if the 32-bit Linux PRPSINFO structure's `pr_uid' and `pr_gid'
   1839      members use a 16-bit data type.  */
   1840   unsigned linux_prpsinfo32_ugid16 : 1;
   1841 
   1842   /* True if the 64-bit Linux PRPSINFO structure's `pr_uid' and `pr_gid'
   1843      members use a 16-bit data type.  */
   1844   unsigned linux_prpsinfo64_ugid16 : 1;
   1845 
   1846   /* True if the backend can use mmap to map in all input section
   1847      contents.  All bfd_malloc_and_get_section and free usages on
   1848      section contents must be replaced by _bfd_elf_mmap_section_contents
   1849      and _bfd_elf_munmap_section_contents.  */
   1850   unsigned use_mmap : 1;
   1851 };
   1852 
   1853 #ifndef __cplusplus
   1854 typedef const struct elf_backend_data elf_backend_data;
   1855 #endif
   1856 
   1857 /* Information about reloc sections associated with a bfd_elf_section_data
   1858    structure.  */
   1859 struct bfd_elf_section_reloc_data
   1860 {
   1861   /* The ELF header for the reloc section associated with this
   1862      section, if any.  */
   1863   Elf_Internal_Shdr *hdr;
   1864   /* The number of relocations currently assigned to HDR.  */
   1865   unsigned int count;
   1866   /* The ELF section number of the reloc section.  Only used for an
   1867      output file.  */
   1868   int idx;
   1869   /* Used by the backend linker to store the symbol hash table entries
   1870      associated with relocs against global symbols.  */
   1871   struct elf_link_hash_entry **hashes;
   1872 };
   1873 
   1874 /* Information stored for each BFD section in an ELF file.  This
   1875    structure is allocated by elf_new_section_hook.  */
   1876 
   1877 struct bfd_elf_section_data
   1878 {
   1879   /* The ELF header for this section.  */
   1880   Elf_Internal_Shdr this_hdr;
   1881 
   1882   /* INPUT_SECTION_FLAGS if specified in the linker script.  */
   1883   struct flag_info *section_flag_info;
   1884 
   1885   /* Information about the REL and RELA reloc sections associated
   1886      with this section, if any.  */
   1887   struct bfd_elf_section_reloc_data rel, rela;
   1888 
   1889   /* The ELF section number of this section.  */
   1890   int this_idx;
   1891 
   1892   /* Used by the backend linker when generating a shared library to
   1893      record the dynamic symbol index for a section symbol
   1894      corresponding to this section.  A value of 0 means that there is
   1895      no dynamic symbol for this section.  */
   1896   int dynindx;
   1897 
   1898   /* A pointer to the linked-to section for SHF_LINK_ORDER.  */
   1899   asection *linked_to;
   1900 
   1901   /* A pointer to the swapped relocs.  If the section uses REL relocs,
   1902      rather than RELA, all the r_addend fields will be zero.  This
   1903      pointer may be NULL.  It is used by the backend linker.  */
   1904   Elf_Internal_Rela *relocs;
   1905 
   1906   /* A pointer to a linked list tracking dynamic relocs copied for
   1907      local symbols.  */
   1908   void *local_dynrel;
   1909 
   1910   /* A pointer to the bfd section used for dynamic relocs.  */
   1911   asection *sreloc;
   1912 
   1913   union {
   1914     /* Group name, if this section is a member of a group.  */
   1915     const char *name;
   1916 
   1917     /* Group signature sym, if this is the SHT_GROUP section.  */
   1918     struct bfd_symbol *id;
   1919   } group;
   1920 
   1921   /* For a member of a group, points to the SHT_GROUP section.
   1922      NULL for the SHT_GROUP section itself and non-group sections.  */
   1923   asection *sec_group;
   1924 
   1925   /* A linked list of member sections in the group.  Circular when used by
   1926      the linker.  For the SHT_GROUP section, points at first member.  */
   1927   asection *next_in_group;
   1928 
   1929   /* The FDEs associated with this section.  The u.fde.next_in_section
   1930      field acts as a chain pointer.  */
   1931   struct eh_cie_fde *fde_list;
   1932 
   1933   /* Link from a text section to its .eh_frame_entry section.  */
   1934   asection *eh_frame_entry;
   1935 
   1936   /* If the mmapped_p flag is set, this points to the actual mmapped
   1937      address of contents.  If it is set to NULL, contents isn't
   1938      mmapped.  */
   1939   void *contents_addr;
   1940 
   1941   /* If the mmapped_p flag is set, this is the actual mmapped size of
   1942      contents.  */
   1943   size_t contents_size;
   1944 
   1945   /* TRUE if the section has secondary reloc sections associated with it.
   1946      FIXME: In the future it might be better to change this into a list
   1947      of secondary reloc sections, making lookup easier and faster.  */
   1948   bool has_secondary_relocs;
   1949 };
   1950 
   1951 #define elf_section_data(sec) ((struct bfd_elf_section_data*)(sec)->used_by_bfd)
   1952 #define elf_linked_to_section(sec) (elf_section_data(sec)->linked_to)
   1953 #define elf_section_type(sec)	(elf_section_data(sec)->this_hdr.sh_type)
   1954 #define elf_section_flags(sec)	(elf_section_data(sec)->this_hdr.sh_flags)
   1955 #define elf_section_info(sec)	(elf_section_data(sec)->this_hdr.sh_info)
   1956 #define elf_group_name(sec)	(elf_section_data(sec)->group.name)
   1957 #define elf_group_id(sec)	(elf_section_data(sec)->group.id)
   1958 #define elf_next_in_group(sec)	(elf_section_data(sec)->next_in_group)
   1959 #define elf_fde_list(sec)	(elf_section_data(sec)->fde_list)
   1960 #define elf_sec_group(sec)	(elf_section_data(sec)->sec_group)
   1961 #define elf_section_eh_frame_entry(sec)	(elf_section_data(sec)->eh_frame_entry)
   1962 
   1963 #define xvec_get_elf_backend_data(xvec) \
   1964   ((const struct elf_backend_data *) (xvec)->backend_data)
   1965 
   1966 #define get_elf_backend_data(abfd) \
   1967    xvec_get_elf_backend_data ((abfd)->xvec)
   1968 
   1969 #define ABI_64_P(abfd) \
   1970   (get_elf_backend_data (abfd)->s->elfclass == ELFCLASS64)
   1971 
   1972 /* The least object attributes (within an attributes subsection) known
   1973    for any target.  Some code assumes that the value 0 is not used and
   1974    the field for that attribute can instead be used as a marker to
   1975    indicate that attributes have been initialized.  */
   1976 #define LEAST_KNOWN_OBJ_ATTRIBUTE 2
   1977 
   1978 /* The maximum number of known object attributes for any target.  */
   1979 #define NUM_KNOWN_OBJ_ATTRIBUTES 77
   1980 
   1981 /* The value of an object attribute.  The type indicates whether the attribute
   1982    holds and integer, a string, or both.  It can also indicate that there can
   1983    be no default (i.e. all values must be written to file, even zero), or
   1984    that the value is in error and should not be written to file.  */
   1985 
   1986 typedef struct obj_attribute
   1987 {
   1988 #define ATTR_TYPE_FLAG_INT_VAL    (1 << 0)
   1989 #define ATTR_TYPE_FLAG_STR_VAL    (1 << 1)
   1990 #define ATTR_TYPE_FLAG_NO_DEFAULT (1 << 2)
   1991 #define ATTR_TYPE_FLAG_ERROR	  (1 << 3)
   1992 
   1993 #define ATTR_TYPE_HAS_INT_VAL(TYPE)	((TYPE) & ATTR_TYPE_FLAG_INT_VAL)
   1994 #define ATTR_TYPE_HAS_STR_VAL(TYPE)	((TYPE) & ATTR_TYPE_FLAG_STR_VAL)
   1995 #define ATTR_TYPE_HAS_NO_DEFAULT(TYPE)	((TYPE) & ATTR_TYPE_FLAG_NO_DEFAULT)
   1996 #define ATTR_TYPE_HAS_ERROR(TYPE)	((TYPE) & ATTR_TYPE_FLAG_ERROR)
   1997 
   1998   int type;
   1999   unsigned int i;
   2000   char *s;
   2001 } obj_attribute;
   2002 
   2003 typedef struct obj_attribute_list
   2004 {
   2005   struct obj_attribute_list *next;
   2006   obj_attr_tag_t tag;
   2007   obj_attribute attr;
   2008 } obj_attribute_list;
   2009 
   2010 /* Object attributes may either be defined by the processor ABI, index
   2011    OBJ_ATTR_PROC in the *_obj_attributes arrays, or be GNU-specific
   2012    (and possibly also processor-specific), index OBJ_ATTR_GNU.  */
   2013 typedef enum {
   2014   OBJ_ATTR_PROC,
   2015   OBJ_ATTR_GNU,
   2016 } obj_attr_vendor_t;
   2017 #define OBJ_ATTR_FIRST OBJ_ATTR_PROC
   2018 #define OBJ_ATTR_LAST OBJ_ATTR_GNU
   2019 
   2020 /* The following object attribute tags are taken as generic, for all
   2021    targets and for "gnu" where there is no target standard.  */
   2022 enum
   2023 {
   2024   Tag_NULL = 0,
   2025   Tag_File = 1,
   2026   Tag_Section = 2,
   2027   Tag_Symbol = 3,
   2028   Tag_compatibility = 32
   2029 };
   2030 
   2031 /* The following struct stores information about every SystemTap section
   2032    found in the object file.  */
   2033 struct sdt_note
   2034 {
   2035   struct sdt_note *next;
   2036   bfd_size_type size;
   2037   bfd_byte data[1];
   2038 };
   2039 
   2040 /* tdata information grabbed from an elf core file.  */
   2041 struct core_elf_obj_tdata
   2042 {
   2043   int signal;
   2044   int pid;
   2045   int lwpid;
   2046   char* program;
   2047   char* command;
   2048 };
   2049 
   2050 /* Extra tdata information held for output ELF BFDs.  */
   2051 struct output_elf_obj_tdata
   2052 {
   2053   struct elf_segment_map *seg_map;
   2054   struct elf_strtab_hash *strtab_ptr;
   2055 
   2056   /* STT_SECTION symbols for each section */
   2057   asymbol **section_syms;
   2058 
   2059   /* NT_GNU_BUILD_ID note type info.  */
   2060   struct
   2061   {
   2062     bool (*after_write_object_contents) (bfd *);
   2063     const char *style;
   2064     asection *sec;
   2065   } build_id;
   2066 
   2067   /* FDO_PACKAGING_METADATA note type info.  */
   2068   struct
   2069   {
   2070     bool (*after_write_object_contents) (bfd *);
   2071     const char *json;
   2072     asection *sec;
   2073   } package_metadata;
   2074 
   2075   /* Records the result of `get_program_header_size'.  */
   2076   bfd_size_type program_header_size;
   2077 
   2078   /* Used when laying out sections.  */
   2079   file_ptr next_file_pos;
   2080 
   2081   /* Linker information.  */
   2082   struct bfd_link_info *link_info;
   2083 
   2084   unsigned int num_section_syms;
   2085   unsigned int shstrtab_section, strtab_section;
   2086 
   2087   /* Segment flags for the PT_GNU_STACK segment.  */
   2088   unsigned int stack_flags;
   2089 
   2090   /* Used to determine if PT_GNU_SFRAME segment header should be
   2091      created.  */
   2092   asection *sframe;
   2093 
   2094   /* Holds the object attributes section if it exists.  */
   2095   asection *obj_object_attributes;
   2096 
   2097   /* Used to determine if the e_flags field has been initialized */
   2098   bool flags_init;
   2099 };
   2100 
   2101 /* Indicate if the bfd contains SHF_GNU_MBIND/SHF_GNU_RETAIN sections or
   2102    symbols that have the STT_GNU_IFUNC symbol type or STB_GNU_UNIQUE
   2103    binding.  Used to set the osabi field in the ELF header structure.  */
   2104 enum elf_gnu_osabi
   2105 {
   2106   elf_gnu_osabi_mbind = 1 << 0,
   2107   elf_gnu_osabi_ifunc = 1 << 1,
   2108   elf_gnu_osabi_unique = 1 << 2,
   2109   elf_gnu_osabi_retain = 1 << 3,
   2110 };
   2111 
   2112 typedef struct elf_section_list
   2113 {
   2114   Elf_Internal_Shdr	     hdr;
   2115   unsigned int		     ndx;
   2116   struct elf_section_list *  next;
   2117 } elf_section_list;
   2118 
   2119 enum dynamic_lib_link_class {
   2120   DYN_NORMAL = 0,
   2121   DYN_AS_NEEDED = 1,
   2122   DYN_DT_NEEDED = 2,
   2123   DYN_NO_ADD_NEEDED = 4,
   2124   DYN_NO_NEEDED = 8
   2125 };
   2126 
   2127 /* Some private data is stashed away for future use using the tdata pointer
   2128    in the bfd structure.  */
   2129 
   2130 struct elf_obj_tdata
   2131 {
   2132   Elf_Internal_Ehdr elf_header[1];	/* Actual data, but ref like ptr */
   2133   Elf_Internal_Shdr **elf_sect_ptr;
   2134   Elf_Internal_Phdr *phdr;
   2135   Elf_Internal_Shdr symtab_hdr;
   2136   Elf_Internal_Shdr shstrtab_hdr;
   2137   Elf_Internal_Shdr strtab_hdr;
   2138   Elf_Internal_Shdr dynsymtab_hdr;
   2139   Elf_Internal_Shdr dynstrtab_hdr;
   2140   Elf_Internal_Shdr dynversym_hdr;
   2141   Elf_Internal_Shdr dynverref_hdr;
   2142   Elf_Internal_Shdr dynverdef_hdr;
   2143   Elf_Internal_Sym *dt_symtab;
   2144   bfd_byte *dt_versym;
   2145   bfd_byte *dt_verdef;
   2146   bfd_byte *dt_verneed;
   2147   size_t dt_symtab_count;
   2148   size_t dt_verdef_count;
   2149   size_t dt_verneed_count;
   2150   char * dt_strtab;
   2151   size_t dt_strsz;
   2152   elf_section_list * symtab_shndx_list;
   2153   bfd_vma gp;				/* The gp value */
   2154   unsigned int gp_size;			/* The gp size */
   2155   unsigned int num_elf_sections;	/* elf_sect_ptr size */
   2156   unsigned char *being_created;
   2157 
   2158   /* A mapping from external symbols to entries in the linker hash
   2159      table, used when linking.  This is indexed by the symbol index
   2160      minus the sh_info field of the symbol table header.  */
   2161   struct elf_link_hash_entry **sym_hashes;
   2162 
   2163   /* Section indices of local symbols, used by gc-sections.  */
   2164   unsigned int *loc_shndx;
   2165 
   2166   /* Track usage and final offsets of GOT entries for local symbols.
   2167      This array is indexed by symbol index.  Elements are used
   2168      identically to "got" in struct elf_link_hash_entry.  */
   2169   union
   2170     {
   2171       bfd_signed_vma *refcounts;
   2172       bfd_vma *offsets;
   2173       struct got_entry **ents;
   2174     } local_got;
   2175 
   2176   /* The linker ELF emulation code needs to let the backend ELF linker
   2177      know what filename should be used for a dynamic object if the
   2178      dynamic object is found using a search.  The emulation code then
   2179      sometimes needs to know what name was actually used.  Until the
   2180      file has been added to the linker symbol table, this field holds
   2181      the name the linker wants.  After it has been added, it holds the
   2182      name actually used, which will be the DT_SONAME entry if there is
   2183      one.  */
   2184   const char *dt_name;
   2185 
   2186   /* The linker emulation needs to know what audit libs
   2187      are used by a dynamic object.  */
   2188   const char *dt_audit;
   2189 
   2190   /* Used by find_nearest_line entry point.  */
   2191   void *line_info;
   2192 
   2193   /* A place to stash dwarf1 info for this bfd.  */
   2194   void *dwarf1_find_line_info;
   2195 
   2196   /* A place to stash dwarf2 info for this bfd.  */
   2197   void *dwarf2_find_line_info;
   2198 
   2199   /* Stash away info for yet another find line/function variant.  */
   2200   void *elf_find_function_cache;
   2201 
   2202   /* Number of symbol version definitions we are about to emit.  */
   2203   unsigned int cverdefs;
   2204 
   2205   /* Number of symbol version references we are about to emit.  */
   2206   unsigned int cverrefs;
   2207 
   2208   /* Symbol version definitions in external objects.  */
   2209   Elf_Internal_Verdef *verdef;
   2210 
   2211   /* Symbol version references to external objects.  */
   2212   Elf_Internal_Verneed *verref;
   2213 
   2214   /* A pointer to the .eh_frame section.  */
   2215   asection *eh_frame_section;
   2216 
   2217   /* A pointer to the .sframe section.  */
   2218   asection *sframe_section;
   2219 
   2220   /* Symbol buffer.  */
   2221   void *symbuf;
   2222 
   2223   /* List of GNU properties.  Will be updated by setup_gnu_properties
   2224      after all input GNU properties are merged for output.  */
   2225   elf_property_list *properties;
   2226 
   2227   /* The version of object attributes for this object.
   2228      For an input object, the format version used to store the data.
   2229      For an output object, the targeted format version.  */
   2230   obj_attr_version_t obj_attr_version;
   2231 
   2232   obj_attribute known_obj_attributes[2][NUM_KNOWN_OBJ_ATTRIBUTES];
   2233   obj_attribute_list *other_obj_attributes[2];
   2234 
   2235   /* Object attributes v2: A subsection can only hold attributes with the
   2236      same data type (uleb128, NTBS, etc), so each type requires a separate
   2237      subsection.  */
   2238   obj_attr_subsection_list_t obj_attr_subsections;
   2239 
   2240   /* Linked-list containing information about every Systemtap section
   2241      found in the object file.  Each section corresponds to one entry
   2242      in the list.  */
   2243   struct sdt_note *sdt_note_head;
   2244 
   2245   unsigned int symtab_section, dynsymtab_section;
   2246   unsigned int dynversym_section, dynverdef_section, dynverref_section;
   2247 
   2248   /* An identifier used to distinguish different target
   2249      specific extensions to this structure.  */
   2250   ENUM_BITFIELD (elf_target_id) object_id : 6;
   2251 
   2252   /* Whether a dyanmic object was specified normally on the linker
   2253      command line, or was specified when --as-needed was in effect,
   2254      or was found via a DT_NEEDED entry.  */
   2255   ENUM_BITFIELD (dynamic_lib_link_class) dyn_lib_class : 4;
   2256 
   2257   /* Whether the bfd uses OS specific bits that require ELFOSABI_GNU.  */
   2258   ENUM_BITFIELD (elf_gnu_osabi) has_gnu_osabi : 4;
   2259 
   2260   /* Whether if the bfd contains the GNU_PROPERTY_NO_COPY_ON_PROTECTED
   2261      property.  */
   2262   unsigned int has_no_copy_on_protected : 1;
   2263 
   2264   /* Whether if the bfd contains the
   2265      GNU_PROPERTY_1_NEEDED_INDIRECT_EXTERN_ACCESS property.  */
   2266   unsigned int has_indirect_extern_access : 1;
   2267 
   2268   /* Irix 5 often screws up the symbol table, sorting local symbols
   2269      after global symbols.  This flag is set if the symbol table in
   2270      this BFD appears to be screwed up.  If it is, we ignore the
   2271      sh_info field in the symbol table header, and always read all the
   2272      symbols.  */
   2273   unsigned int bad_symtab : 1;
   2274 
   2275   /* Set if DT_FLAGS_1 has DF_1_PIE set.  */
   2276   unsigned int is_pie : 1;
   2277 
   2278   /* Information grabbed from an elf core file.  */
   2279   struct core_elf_obj_tdata *core;
   2280 
   2281   /* More information held for output ELF BFDs.  */
   2282   struct output_elf_obj_tdata *o;
   2283 };
   2284 
   2285 #define elf_tdata(bfd)		((bfd) -> tdata.elf_obj_data)
   2286 
   2287 #define elf_object_id(bfd)	(elf_tdata(bfd) -> object_id)
   2288 #define elf_program_header_size(bfd) (elf_tdata(bfd) -> o->program_header_size)
   2289 #define elf_elfheader(bfd)	(elf_tdata(bfd) -> elf_header)
   2290 #define elf_elfsections(bfd)	(elf_tdata(bfd) -> elf_sect_ptr)
   2291 #define elf_numsections(bfd)	(elf_tdata(bfd) -> num_elf_sections)
   2292 #define elf_seg_map(bfd)	(elf_tdata(bfd) -> o->seg_map)
   2293 #define elf_link_info(bfd)	(elf_tdata(bfd) -> o->link_info)
   2294 #define elf_next_file_pos(bfd)	(elf_tdata(bfd) -> o->next_file_pos)
   2295 #define elf_stack_flags(bfd)	(elf_tdata(bfd) -> o->stack_flags)
   2296 #define elf_sframe(bfd)		(elf_tdata(bfd) -> o->sframe)
   2297 #define elf_obj_object_attributes(bfd) \
   2298 				(elf_tdata(bfd) -> o->obj_object_attributes)
   2299 #define elf_shstrtab(bfd)	(elf_tdata(bfd) -> o->strtab_ptr)
   2300 #define elf_onesymtab(bfd)	(elf_tdata(bfd) -> symtab_section)
   2301 #define elf_symtab_shndx_list(bfd)	(elf_tdata(bfd) -> symtab_shndx_list)
   2302 #define elf_strtab_sec(bfd)	(elf_tdata(bfd) -> o->strtab_section)
   2303 #define elf_shstrtab_sec(bfd)	(elf_tdata(bfd) -> o->shstrtab_section)
   2304 #define elf_symtab_hdr(bfd)	(elf_tdata(bfd) -> symtab_hdr)
   2305 #define elf_dynsymtab(bfd)	(elf_tdata(bfd) -> dynsymtab_section)
   2306 #define elf_dynversym(bfd)	(elf_tdata(bfd) -> dynversym_section)
   2307 #define elf_dynverdef(bfd)	(elf_tdata(bfd) -> dynverdef_section)
   2308 #define elf_dynverref(bfd)	(elf_tdata(bfd) -> dynverref_section)
   2309 #define elf_eh_frame_section(bfd) \
   2310 				(elf_tdata(bfd) -> eh_frame_section)
   2311 #define elf_sframe_section(bfd) \
   2312 				(elf_tdata(bfd) -> sframe_section)
   2313 #define elf_section_syms(bfd)	(elf_tdata(bfd) -> o->section_syms)
   2314 #define elf_num_section_syms(bfd) (elf_tdata(bfd) -> o->num_section_syms)
   2315 #define core_prpsinfo(bfd)	(elf_tdata(bfd) -> prpsinfo)
   2316 #define core_prstatus(bfd)	(elf_tdata(bfd) -> prstatus)
   2317 #define elf_gp(bfd)		(elf_tdata(bfd) -> gp)
   2318 #define elf_gp_size(bfd)	(elf_tdata(bfd) -> gp_size)
   2319 #define elf_sym_hashes(bfd)	(elf_tdata(bfd) -> sym_hashes)
   2320 #define elf_loc_shndx(bfd)	(elf_tdata(bfd) -> loc_shndx)
   2321 #define elf_local_got_refcounts(bfd) (elf_tdata(bfd) -> local_got.refcounts)
   2322 #define elf_local_got_offsets(bfd) (elf_tdata(bfd) -> local_got.offsets)
   2323 #define elf_local_got_ents(bfd) (elf_tdata(bfd) -> local_got.ents)
   2324 #define elf_dt_name(bfd)	(elf_tdata(bfd) -> dt_name)
   2325 #define elf_dt_audit(bfd)	(elf_tdata(bfd) -> dt_audit)
   2326 #define elf_dyn_lib_class(bfd)	(elf_tdata(bfd) -> dyn_lib_class)
   2327 #define elf_bad_symtab(bfd)	(elf_tdata(bfd) -> bad_symtab)
   2328 #define elf_flags_init(bfd)	(elf_tdata(bfd) -> o->flags_init)
   2329 #define elf_use_dt_symtab_p(bfd) (elf_tdata(bfd) -> dt_symtab_count != 0)
   2330 #define elf_obj_attr_version(bfd) (elf_tdata (bfd) -> obj_attr_version)
   2331 #define elf_known_obj_attributes(bfd) (elf_tdata (bfd) -> known_obj_attributes)
   2332 #define elf_other_obj_attributes(bfd) (elf_tdata (bfd) -> other_obj_attributes)
   2333 #define elf_known_obj_attributes_proc(bfd) \
   2334   (elf_known_obj_attributes (bfd) [OBJ_ATTR_PROC])
   2335 #define elf_other_obj_attributes_proc(bfd) \
   2336   (elf_other_obj_attributes (bfd) [OBJ_ATTR_PROC])
   2337 #define elf_obj_attr_subsections(bfd) (elf_tdata (bfd) -> obj_attr_subsections)
   2338 #define elf_properties(bfd) (elf_tdata (bfd) -> properties)
   2339 #define elf_has_no_copy_on_protected(bfd) \
   2340   (elf_tdata(bfd) -> has_no_copy_on_protected)
   2341 #define elf_has_indirect_extern_access(bfd) \
   2342   (elf_tdata(bfd) -> has_indirect_extern_access)
   2343 
   2344 extern void _bfd_elf_swap_verdef_in
   2346   (bfd *, const Elf_External_Verdef *, Elf_Internal_Verdef *) ATTRIBUTE_HIDDEN;
   2347 extern void _bfd_elf_swap_verdef_out
   2348   (bfd *, const Elf_Internal_Verdef *, Elf_External_Verdef *) ATTRIBUTE_HIDDEN;
   2349 extern void _bfd_elf_swap_verdaux_in
   2350   (bfd *, const Elf_External_Verdaux *, Elf_Internal_Verdaux *)
   2351   ATTRIBUTE_HIDDEN;
   2352 extern void _bfd_elf_swap_verdaux_out
   2353   (bfd *, const Elf_Internal_Verdaux *, Elf_External_Verdaux *)
   2354   ATTRIBUTE_HIDDEN;
   2355 extern void _bfd_elf_swap_verneed_in
   2356   (bfd *, const Elf_External_Verneed *, Elf_Internal_Verneed *)
   2357   ATTRIBUTE_HIDDEN;
   2358 extern void _bfd_elf_swap_verneed_out
   2359   (bfd *, const Elf_Internal_Verneed *, Elf_External_Verneed *)
   2360   ATTRIBUTE_HIDDEN;
   2361 extern void _bfd_elf_swap_vernaux_in
   2362   (bfd *, const Elf_External_Vernaux *, Elf_Internal_Vernaux *)
   2363   ATTRIBUTE_HIDDEN;
   2364 extern void _bfd_elf_swap_vernaux_out
   2365   (bfd *, const Elf_Internal_Vernaux *, Elf_External_Vernaux *)
   2366   ATTRIBUTE_HIDDEN;
   2367 extern void _bfd_elf_swap_versym_in
   2368   (bfd *, const Elf_External_Versym *, Elf_Internal_Versym *) ATTRIBUTE_HIDDEN;
   2369 extern void _bfd_elf_swap_versym_out
   2370   (bfd *, const Elf_Internal_Versym *, Elf_External_Versym *) ATTRIBUTE_HIDDEN;
   2371 
   2372 extern unsigned int _bfd_elf_section_from_bfd_section
   2373   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   2374 extern char *bfd_elf_string_from_elf_section
   2375   (bfd *, unsigned, unsigned);
   2376 extern Elf_Internal_Sym *bfd_elf_get_elf_syms
   2377   (bfd *, Elf_Internal_Shdr *, size_t, size_t, Elf_Internal_Sym *, void *,
   2378    Elf_External_Sym_Shndx *);
   2379 extern char * bfd_elf_get_str_section (bfd *, unsigned int);
   2380 extern const char *bfd_elf_sym_name
   2381   (bfd *, Elf_Internal_Shdr *, Elf_Internal_Sym *, asection *);
   2382 
   2383 extern bool _bfd_elf_copy_private_bfd_data
   2384   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
   2385 extern bool _bfd_elf_print_private_bfd_data
   2386   (bfd *, void *) ATTRIBUTE_HIDDEN;
   2387 const char * _bfd_elf_get_symbol_version_string
   2388   (bfd *, asymbol *, bool, bool *) ATTRIBUTE_HIDDEN;
   2389 extern void _bfd_elf_print_symbol
   2390   (bfd *, void *, asymbol *, bfd_print_symbol_type) ATTRIBUTE_HIDDEN;
   2391 
   2392 extern unsigned int _bfd_elf_eh_frame_address_size
   2393   (bfd *, const asection *) ATTRIBUTE_HIDDEN;
   2394 extern bfd_byte _bfd_elf_encode_eh_address
   2395   (bfd *abfd, struct bfd_link_info *info, asection *osec, bfd_vma offset,
   2396    asection *loc_sec, bfd_vma loc_offset, bfd_vma *encoded) ATTRIBUTE_HIDDEN;
   2397 extern bool _bfd_elf_can_make_relative
   2398   (bfd *input_bfd, struct bfd_link_info *info, asection *eh_frame_section)
   2399   ATTRIBUTE_HIDDEN;
   2400 
   2401 extern enum elf_reloc_type_class _bfd_elf_reloc_type_class
   2402   (const struct bfd_link_info *, const asection *,
   2403    const Elf_Internal_Rela *) ATTRIBUTE_HIDDEN;
   2404 extern bfd_vma _bfd_elf_rela_local_sym
   2405   (bfd *, Elf_Internal_Sym *, asection **, Elf_Internal_Rela *)
   2406   ATTRIBUTE_HIDDEN;
   2407 extern bfd_vma _bfd_elf_rel_local_sym
   2408   (bfd *, Elf_Internal_Sym *, asection **, bfd_vma) ATTRIBUTE_HIDDEN;
   2409 extern bfd_vma _bfd_elf_section_offset
   2410   (bfd *, struct bfd_link_info *, asection *, bfd_vma) ATTRIBUTE_HIDDEN;
   2411 
   2412 extern unsigned long bfd_elf_hash
   2413   (const char *);
   2414 extern unsigned long bfd_elf_gnu_hash
   2415   (const char *);
   2416 
   2417 extern bfd_reloc_status_type bfd_elf_generic_reloc
   2418   (bfd *, arelent *, asymbol *, void *, asection *, bfd *, char **);
   2419 extern bool bfd_elf_allocate_object
   2420   (bfd *, size_t);
   2421 extern bool bfd_elf_make_object
   2422   (bfd *);
   2423 extern bool bfd_elf_mkcorefile
   2424   (bfd *);
   2425 extern bool _bfd_elf_make_section_from_shdr
   2426   (bfd *, Elf_Internal_Shdr *, const char *, int) ATTRIBUTE_HIDDEN;
   2427 extern bool _bfd_elf_make_section_from_phdr
   2428   (bfd *, Elf_Internal_Phdr *, int, const char *) ATTRIBUTE_HIDDEN;
   2429 extern struct bfd_hash_entry *_bfd_elf_link_hash_newfunc
   2430   (struct bfd_hash_entry *, struct bfd_hash_table *, const char *)
   2431   ATTRIBUTE_HIDDEN;
   2432 extern struct bfd_link_hash_table *_bfd_elf_link_hash_table_create
   2433   (bfd *) ATTRIBUTE_HIDDEN;
   2434 extern void _bfd_elf_link_hash_table_free
   2435   (bfd *) ATTRIBUTE_HIDDEN;
   2436 extern void _bfd_elf_link_hash_copy_indirect
   2437   (struct bfd_link_info *, struct elf_link_hash_entry *,
   2438    struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
   2439 extern void _bfd_elf_link_hash_hide_symbol
   2440   (struct bfd_link_info *, struct elf_link_hash_entry *, bool)
   2441   ATTRIBUTE_HIDDEN;
   2442 extern void _bfd_elf_link_hide_symbol
   2443   (bfd *, struct bfd_link_info *, struct bfd_link_hash_entry *)
   2444   ATTRIBUTE_HIDDEN;
   2445 extern bool _bfd_elf_link_hash_fixup_symbol
   2446   (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
   2447 extern bool _bfd_elf_link_hash_table_init
   2448   (struct elf_link_hash_table *, bfd *,
   2449    struct bfd_hash_entry *(*)
   2450      (struct bfd_hash_entry *, struct bfd_hash_table *, const char *),
   2451    unsigned int) ATTRIBUTE_HIDDEN;
   2452 extern bool _bfd_elf_slurp_version_tables
   2453   (bfd *, bool) ATTRIBUTE_HIDDEN;
   2454 extern bool bfd_elf_match_sections_by_type
   2455   (bfd *, const asection *, bfd *, const asection *);
   2456 extern bool bfd_elf_is_group_section
   2457   (bfd *, const struct bfd_section *);
   2458 extern const char *bfd_elf_group_name
   2459   (bfd *, const struct bfd_section *);
   2460 extern bool _bfd_elf_section_already_linked
   2461   (bfd *, asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2462 extern void bfd_elf_set_group_contents
   2463   (bfd *, asection *, void *);
   2464 extern unsigned int _bfd_elf_filter_global_symbols
   2465   (bfd *, struct bfd_link_info *, asymbol **, long) ATTRIBUTE_HIDDEN;
   2466 extern asection *_bfd_elf_check_kept_section
   2467   (asection *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2468 #define _bfd_elf_link_just_syms _bfd_generic_link_just_syms
   2469 extern void _bfd_elf_copy_link_hash_symbol_type
   2470   (bfd *, struct bfd_link_hash_entry *, struct bfd_link_hash_entry *)
   2471   ATTRIBUTE_HIDDEN;
   2472 extern bool bfd_elf_size_group_sections
   2473   (struct bfd_link_info *);
   2474 extern bool _bfd_elf_fixup_group_sections
   2475   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   2476 extern bool _bfd_elf_copy_private_header_data
   2477   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
   2478 extern bool _bfd_elf_copy_private_symbol_data
   2479   (bfd *, asymbol **, bfd *, asymbol **) ATTRIBUTE_HIDDEN;
   2480 extern bool _bfd_elf_copy_private_section_data
   2481   (bfd *, asection *, bfd *, asection *, struct bfd_link_info *)
   2482   ATTRIBUTE_HIDDEN;
   2483 extern bool _bfd_elf_write_object_contents
   2484   (bfd *) ATTRIBUTE_HIDDEN;
   2485 extern bool _bfd_elf_write_corefile_contents
   2486   (bfd *) ATTRIBUTE_HIDDEN;
   2487 extern bool _bfd_elf_set_section_contents
   2488   (bfd *, sec_ptr, const void *, file_ptr, bfd_size_type) ATTRIBUTE_HIDDEN;
   2489 extern long _bfd_elf_get_symtab_upper_bound
   2490   (bfd *) ATTRIBUTE_HIDDEN;
   2491 extern long _bfd_elf_canonicalize_symtab
   2492   (bfd *, asymbol **) ATTRIBUTE_HIDDEN;
   2493 extern long _bfd_elf_get_dynamic_symtab_upper_bound
   2494   (bfd *) ATTRIBUTE_HIDDEN;
   2495 extern long _bfd_elf_canonicalize_dynamic_symtab
   2496   (bfd *, asymbol **) ATTRIBUTE_HIDDEN;
   2497 extern long _bfd_elf_get_synthetic_symtab
   2498   (bfd *, long, asymbol **, long, asymbol **, asymbol **) ATTRIBUTE_HIDDEN;
   2499 extern long _bfd_elf_get_reloc_upper_bound
   2500   (bfd *, sec_ptr) ATTRIBUTE_HIDDEN;
   2501 extern long _bfd_elf_canonicalize_reloc
   2502   (bfd *, sec_ptr, arelent **, asymbol **) ATTRIBUTE_HIDDEN;
   2503 extern asection * _bfd_elf_get_dynamic_reloc_section
   2504   (bfd *, asection *, bool) ATTRIBUTE_HIDDEN;
   2505 extern asection * _bfd_elf_make_dynamic_reloc_section
   2506   (asection *, bfd *, unsigned int, bfd *, bool) ATTRIBUTE_HIDDEN;
   2507 extern long _bfd_elf_get_dynamic_reloc_upper_bound
   2508   (bfd *) ATTRIBUTE_HIDDEN;
   2509 extern long _bfd_elf_canonicalize_dynamic_reloc
   2510   (bfd *, arelent **, asymbol **) ATTRIBUTE_HIDDEN;
   2511 extern asymbol *_bfd_elf_make_empty_symbol
   2512   (bfd *) ATTRIBUTE_HIDDEN;
   2513 extern void _bfd_elf_get_symbol_info
   2514   (bfd *, asymbol *, symbol_info *) ATTRIBUTE_HIDDEN;
   2515 extern bool _bfd_elf_is_local_label_name
   2516   (bfd *, const char *) ATTRIBUTE_HIDDEN;
   2517 extern alent *_bfd_elf_get_lineno
   2518   (bfd *, asymbol *) ATTRIBUTE_HIDDEN;
   2519 extern bool _bfd_elf_set_arch_mach
   2520   (bfd *, enum bfd_architecture, unsigned long) ATTRIBUTE_HIDDEN;
   2521 extern bool _bfd_elf_find_nearest_line
   2522   (bfd *, asymbol **, asection *, bfd_vma,
   2523    const char **, const char **, unsigned int *, unsigned int *)
   2524   ATTRIBUTE_HIDDEN;
   2525 extern bool _bfd_elf_find_nearest_line_with_alt
   2526   (bfd *, const char *, asymbol **, asection *, bfd_vma,
   2527    const char **, const char **, unsigned int *, unsigned int *)
   2528   ATTRIBUTE_HIDDEN;
   2529 extern bool _bfd_elf_find_line
   2530   (bfd *, asymbol **, asymbol *, const char **, unsigned int *)
   2531   ATTRIBUTE_HIDDEN;
   2532 extern bool _bfd_elf_find_inliner_info
   2533   (bfd *, const char **, const char **, unsigned int *) ATTRIBUTE_HIDDEN;
   2534 extern asymbol *_bfd_elf_find_function
   2535   (bfd *, asymbol **, asection *, bfd_vma, const char **, const char **)
   2536   ATTRIBUTE_HIDDEN;
   2537 #define _bfd_elf_read_minisymbols _bfd_generic_read_minisymbols
   2538 #define _bfd_elf_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
   2539 extern int _bfd_elf_sizeof_headers
   2540   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2541 extern bool _bfd_elf_new_section_hook
   2542   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   2543 extern const struct bfd_elf_special_section *_bfd_elf_get_special_section
   2544   (const char *, const struct bfd_elf_special_section *, unsigned int)
   2545   ATTRIBUTE_HIDDEN;
   2546 extern const struct bfd_elf_special_section *_bfd_elf_get_sec_type_attr
   2547   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   2548 
   2549 extern bool _bfd_elf_link_hide_sym_by_version
   2550   (struct bfd_link_info *, struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
   2551 
   2552 /* If the target doesn't have reloc handling written yet:  */
   2553 extern bool _bfd_elf_no_info_to_howto
   2554   (bfd *, arelent *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN;
   2555 
   2556 extern bool bfd_section_from_shdr
   2557   (bfd *, unsigned int shindex);
   2558 extern bool bfd_section_from_phdr
   2559   (bfd *, Elf_Internal_Phdr *, int);
   2560 
   2561 extern int _bfd_elf_symbol_from_bfd_symbol
   2562   (bfd *, asymbol **) ATTRIBUTE_HIDDEN;
   2563 
   2564 extern Elf_Internal_Sym *bfd_sym_from_r_symndx
   2565   (struct sym_cache *, bfd *, unsigned long);
   2566 extern asection *bfd_section_from_elf_index
   2567   (bfd *, unsigned int);
   2568 
   2569 extern struct elf_strtab_hash * _bfd_elf_strtab_init
   2570   (void) ATTRIBUTE_HIDDEN;
   2571 extern void _bfd_elf_strtab_free
   2572   (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2573 extern size_t _bfd_elf_strtab_add
   2574   (struct elf_strtab_hash *, const char *, bool) ATTRIBUTE_HIDDEN;
   2575 extern void _bfd_elf_strtab_addref
   2576   (struct elf_strtab_hash *, size_t) ATTRIBUTE_HIDDEN;
   2577 extern void _bfd_elf_strtab_delref
   2578   (struct elf_strtab_hash *, size_t) ATTRIBUTE_HIDDEN;
   2579 extern unsigned int _bfd_elf_strtab_refcount
   2580   (struct elf_strtab_hash *, size_t) ATTRIBUTE_HIDDEN;
   2581 extern void _bfd_elf_strtab_clear_all_refs
   2582   (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2583 extern void *_bfd_elf_strtab_save
   2584   (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2585 extern void _bfd_elf_strtab_restore
   2586   (struct elf_strtab_hash *, void *) ATTRIBUTE_HIDDEN;
   2587 extern bfd_size_type _bfd_elf_strtab_size
   2588   (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2589 extern bfd_size_type bfd_elf_strtab_len
   2590   (struct elf_strtab_hash *);
   2591 extern bfd_size_type _bfd_elf_strtab_offset
   2592   (struct elf_strtab_hash *, size_t) ATTRIBUTE_HIDDEN;
   2593 extern const char *bfd_elf_strtab_str
   2594   (struct elf_strtab_hash *, size_t idx, bfd_size_type *offset);
   2595 extern bool _bfd_elf_strtab_emit
   2596   (bfd *, struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2597 extern void _bfd_elf_strtab_finalize
   2598   (struct elf_strtab_hash *) ATTRIBUTE_HIDDEN;
   2599 
   2600 extern bool bfd_elf_parse_eh_frame_entries
   2601   (bfd *, struct bfd_link_info *);
   2602 extern bool _bfd_elf_parse_eh_frame_entry
   2603   (struct bfd_link_info *, asection *, struct elf_reloc_cookie *)
   2604   ATTRIBUTE_HIDDEN;
   2605 extern void _bfd_elf_parse_eh_frame
   2606   (bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *)
   2607   ATTRIBUTE_HIDDEN;
   2608 extern bool _bfd_elf_end_eh_frame_parsing
   2609   (struct bfd_link_info *info) ATTRIBUTE_HIDDEN;
   2610 
   2611 extern int _bfd_elf_discard_section_eh_frame
   2612   (bfd *, struct bfd_link_info *, asection *,
   2613    bool (*) (bfd_vma, void *), struct elf_reloc_cookie *) ATTRIBUTE_HIDDEN;
   2614 extern bool _bfd_elf_adjust_eh_frame_global_symbol
   2615   (struct elf_link_hash_entry *, void *) ATTRIBUTE_HIDDEN;
   2616 extern bool _bfd_elf_discard_section_eh_frame_hdr
   2617   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2618 extern bfd_vma _bfd_elf_eh_frame_section_offset
   2619   (bfd *, struct bfd_link_info *, asection *, bfd_vma) ATTRIBUTE_HIDDEN;
   2620 extern bool _bfd_elf_write_section_eh_frame
   2621   (bfd *, struct bfd_link_info *, asection *, bfd_byte *) ATTRIBUTE_HIDDEN;
   2622 extern bool _bfd_elf_write_linker_section_eh_frame
   2623   (bfd *, struct bfd_link_info *, asection *, bfd_byte *) ATTRIBUTE_HIDDEN;
   2624 extern bool _bfd_elf_write_section_eh_frame_entry
   2625   (bfd *, struct bfd_link_info *, asection *, bfd_byte *) ATTRIBUTE_HIDDEN;
   2626 extern bool _bfd_elf_fixup_eh_frame_hdr
   2627   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2628 extern bool _bfd_elf_write_section_eh_frame_hdr
   2629   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2630 extern bool _bfd_elf_eh_frame_present
   2631   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2632 extern bool _bfd_elf_eh_frame_entry_present
   2633   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2634 extern bool _bfd_elf_maybe_strip_eh_frame_hdr
   2635   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2636 
   2637 extern bool _bfd_elf_sframe_present
   2638   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2639 extern bool _bfd_elf_sframe_present_input_bfds
   2640   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2641 extern bool _bfd_elf_parse_sframe
   2642   (bfd *, struct bfd_link_info *, asection *, struct elf_reloc_cookie *)
   2643   ATTRIBUTE_HIDDEN;
   2644 extern bool _bfd_elf_discard_section_sframe
   2645   (asection *, bool (*) (bfd_vma, void *), struct elf_reloc_cookie *)
   2646   ATTRIBUTE_HIDDEN;
   2647 extern bool _bfd_elf_merge_section_sframe
   2648   (bfd *, struct bfd_link_info *, asection *, bfd_byte *) ATTRIBUTE_HIDDEN;
   2649 extern bfd_vma _bfd_elf_sframe_section_offset
   2650   (bfd *, struct bfd_link_info *, asection *, bfd_vma) ATTRIBUTE_HIDDEN;
   2651 extern bool _bfd_elf_write_section_sframe
   2652   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2653 extern bool _bfd_elf_set_section_sframe
   2654   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2655 
   2656 extern bool _bfd_elf_hash_symbol
   2657   (struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
   2658 
   2659 extern long _bfd_elf_link_lookup_local_dynindx
   2660   (struct bfd_link_info *, bfd *, long) ATTRIBUTE_HIDDEN;
   2661 extern bool _bfd_elf_compute_section_file_positions
   2662   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2663 extern file_ptr _bfd_elf_assign_file_position_for_section
   2664   (Elf_Internal_Shdr *, file_ptr, bool, unsigned char) ATTRIBUTE_HIDDEN;
   2665 extern bool _bfd_elf_modify_headers
   2666   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2667 
   2668 extern bool _bfd_elf_validate_reloc
   2669   (bfd *, arelent *) ATTRIBUTE_HIDDEN;
   2670 
   2671 extern bool bfd_elf_record_link_assignment
   2672   (bfd *, struct bfd_link_info *, const char *, bool,
   2673    bool);
   2674 extern bool bfd_elf_stack_segment_size (bfd *, struct bfd_link_info *,
   2675 					const char *, bfd_vma);
   2676 extern bool bfd_elf_size_dynamic_sections
   2677   (bfd *, const char *, const char *, const char *, const char *, const char *,
   2678    const char * const *, struct bfd_link_info *, struct bfd_section **);
   2679 extern bool bfd_elf_size_dynsym_hash_dynstr
   2680   (bfd *, struct bfd_link_info *);
   2681 extern bool bfd_elf_get_bfd_needed_list
   2682   (bfd *, struct bfd_link_needed_list **);
   2683 extern struct bfd_link_needed_list *bfd_elf_get_needed_list
   2684   (bfd *, struct bfd_link_info *);
   2685 extern void bfd_elf_set_dt_needed_name
   2686   (bfd *, const char *);
   2687 extern const char *bfd_elf_get_dt_soname
   2688   (bfd *);
   2689 extern void bfd_elf_set_dyn_lib_class
   2690   (bfd *, enum dynamic_lib_link_class);
   2691 extern int bfd_elf_get_dyn_lib_class
   2692   (bfd *);
   2693 extern struct bfd_link_needed_list *bfd_elf_get_runpath_list
   2694   (bfd *, struct bfd_link_info *);
   2695 extern int bfd_elf_discard_info
   2696   (bfd *, struct bfd_link_info *);
   2697 extern unsigned int _bfd_elf_default_action_discarded
   2698   (struct bfd_section *) ATTRIBUTE_HIDDEN;
   2699 extern struct bfd_section *bfd_elf_tls_setup
   2700   (bfd *, struct bfd_link_info *);
   2701 
   2702 extern bool bfd_elf_link_create_dynamic_sections
   2703   (bfd *, struct bfd_link_info *);
   2704 extern bool _bfd_elf_omit_section_dynsym_default
   2705   (bfd *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN;
   2706 extern bool _bfd_elf_omit_section_dynsym_all
   2707   (bfd *, struct bfd_link_info *, asection *) ATTRIBUTE_HIDDEN;
   2708 extern bool _bfd_elf_create_dynamic_sections
   2709   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2710 extern bool _bfd_elf_create_got_section
   2711   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2712 extern asection *_bfd_elf_section_for_symbol
   2713   (struct elf_reloc_cookie *, unsigned long) ATTRIBUTE_HIDDEN;
   2714 extern struct elf_link_hash_entry *_bfd_elf_define_linkage_sym
   2715   (bfd *, struct bfd_link_info *, asection *, const char *) ATTRIBUTE_HIDDEN;
   2716 extern void _bfd_elf_init_1_index_section
   2717   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2718 extern void _bfd_elf_init_2_index_sections
   2719   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2720 
   2721 extern bool _bfd_elfcore_make_pseudosection
   2722   (bfd *, char *, size_t, ufile_ptr) ATTRIBUTE_HIDDEN;
   2723 extern char *_bfd_elfcore_strndup
   2724   (bfd *, char *, size_t) ATTRIBUTE_HIDDEN;
   2725 
   2726 extern Elf_Internal_Rela *_bfd_elf_link_read_relocs
   2727   (bfd *, const asection *, void *, Elf_Internal_Rela *, bool);
   2728 extern Elf_Internal_Rela *_bfd_elf_link_info_read_relocs
   2729   (bfd *, struct bfd_link_info *, const asection *, void *, Elf_Internal_Rela *,
   2730    bool) ATTRIBUTE_HIDDEN;
   2731 
   2732 extern bool _bfd_elf_link_output_relocs
   2733   (bfd *, asection *, Elf_Internal_Shdr *, Elf_Internal_Rela *,
   2734    struct elf_link_hash_entry **) ATTRIBUTE_HIDDEN;
   2735 
   2736 extern bool _bfd_elf_link_add_glibc_version_dependency
   2737   (struct elf_find_verdep_info *, const char *const [], bool *)
   2738   ATTRIBUTE_HIDDEN;
   2739 
   2740 extern void _bfd_elf_link_add_dt_relr_dependency
   2741   (struct elf_find_verdep_info *) ATTRIBUTE_HIDDEN;
   2742 
   2743 extern bool _bfd_elf_adjust_dynamic_copy
   2744   (struct bfd_link_info *, struct elf_link_hash_entry *, asection *)
   2745   ATTRIBUTE_HIDDEN;
   2746 
   2747 extern bool _bfd_elf_dynamic_symbol_p
   2748   (struct elf_link_hash_entry *, struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN;
   2749 
   2750 extern bool _bfd_elf_symbol_refs_local_p
   2751   (struct elf_link_hash_entry *, struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN;
   2752 
   2753 extern bfd_reloc_status_type bfd_elf_perform_complex_relocation
   2754   (bfd *, asection *, bfd_byte *, Elf_Internal_Rela *, bfd_vma);
   2755 
   2756 extern bool _bfd_elf_setup_sections
   2757   (bfd *) ATTRIBUTE_HIDDEN;
   2758 
   2759 extern bool _bfd_elf_get_dynamic_symbols
   2760   (bfd *, Elf_Internal_Phdr *, Elf_Internal_Phdr *, size_t,
   2761    bfd_size_type) ATTRIBUTE_HIDDEN;
   2762 extern asection *_bfd_elf_get_section_from_dynamic_symbol
   2763   (bfd *, Elf_Internal_Sym *) ATTRIBUTE_HIDDEN;
   2764 
   2765 extern struct bfd_link_hash_entry *bfd_elf_define_start_stop
   2766   (struct bfd_link_info *, const char *, asection *);
   2767 
   2768 extern bool _bfd_elf_init_file_header (bfd *, struct bfd_link_info *)
   2769   ATTRIBUTE_HIDDEN;
   2770 
   2771 extern bool _bfd_elf_final_write_processing (bfd *) ATTRIBUTE_HIDDEN;
   2772 
   2773 extern bfd_cleanup bfd_elf32_object_p
   2774   (bfd *);
   2775 extern bfd_cleanup bfd_elf32_core_file_p
   2776   (bfd *);
   2777 extern char *bfd_elf32_core_file_failing_command
   2778   (bfd *);
   2779 extern int bfd_elf32_core_file_failing_signal
   2780   (bfd *);
   2781 extern bool bfd_elf32_core_file_matches_executable_p
   2782   (bfd *, bfd *);
   2783 extern int bfd_elf32_core_file_pid
   2784   (bfd *);
   2785 extern bool _bfd_elf32_core_find_build_id
   2786   (bfd *, bfd_vma) ATTRIBUTE_HIDDEN;
   2787 
   2788 extern bool bfd_elf32_swap_symbol_in
   2789   (bfd *, const void *, const void *, Elf_Internal_Sym *);
   2790 extern void bfd_elf32_swap_symbol_out
   2791   (bfd *, const Elf_Internal_Sym *, void *, void *);
   2792 extern void bfd_elf32_swap_reloc_in
   2793   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
   2794 extern void bfd_elf32_swap_reloc_out
   2795   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
   2796 extern void bfd_elf32_swap_reloca_in
   2797   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
   2798 extern void bfd_elf32_swap_reloca_out
   2799   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
   2800 extern void bfd_elf32_swap_phdr_in
   2801   (bfd *, const Elf32_External_Phdr *, Elf_Internal_Phdr *);
   2802 extern void bfd_elf32_swap_phdr_out
   2803   (bfd *, const Elf_Internal_Phdr *, Elf32_External_Phdr *);
   2804 extern void bfd_elf32_swap_dyn_in
   2805   (bfd *, const void *, Elf_Internal_Dyn *);
   2806 extern void bfd_elf32_swap_dyn_out
   2807   (bfd *, const Elf_Internal_Dyn *, void *);
   2808 extern long bfd_elf32_slurp_symbol_table
   2809   (bfd *, asymbol **, bool);
   2810 extern bool bfd_elf32_write_shdrs_and_ehdr
   2811   (bfd *);
   2812 extern int bfd_elf32_write_out_phdrs
   2813   (bfd *, const Elf_Internal_Phdr *, unsigned int);
   2814 extern bool bfd_elf32_checksum_contents
   2815   (bfd * , void (*) (const void *, size_t, void *), void *);
   2816 extern void bfd_elf32_write_relocs
   2817   (bfd *, asection *, void *);
   2818 extern bool bfd_elf32_slurp_reloc_table
   2819   (bfd *, asection *, asymbol **, bool);
   2820 
   2821 extern bfd_cleanup bfd_elf64_object_p
   2822   (bfd *);
   2823 extern bfd_cleanup bfd_elf64_core_file_p
   2824   (bfd *);
   2825 extern char *bfd_elf64_core_file_failing_command
   2826   (bfd *);
   2827 extern int bfd_elf64_core_file_failing_signal
   2828   (bfd *);
   2829 extern bool bfd_elf64_core_file_matches_executable_p
   2830   (bfd *, bfd *);
   2831 extern int bfd_elf64_core_file_pid
   2832   (bfd *);
   2833 extern bool _bfd_elf64_core_find_build_id
   2834   (bfd *, bfd_vma) ATTRIBUTE_HIDDEN;
   2835 
   2836 extern bool bfd_elf64_swap_symbol_in
   2837   (bfd *, const void *, const void *, Elf_Internal_Sym *);
   2838 extern void bfd_elf64_swap_symbol_out
   2839   (bfd *, const Elf_Internal_Sym *, void *, void *);
   2840 extern void bfd_elf64_swap_reloc_in
   2841   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
   2842 extern void bfd_elf64_swap_reloc_out
   2843   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
   2844 extern void bfd_elf64_swap_reloca_in
   2845   (bfd *, const bfd_byte *, Elf_Internal_Rela *);
   2846 extern void bfd_elf64_swap_reloca_out
   2847   (bfd *, const Elf_Internal_Rela *, bfd_byte *);
   2848 extern void bfd_elf64_swap_phdr_in
   2849   (bfd *, const Elf64_External_Phdr *, Elf_Internal_Phdr *);
   2850 extern void bfd_elf64_swap_phdr_out
   2851   (bfd *, const Elf_Internal_Phdr *, Elf64_External_Phdr *);
   2852 extern void bfd_elf64_swap_dyn_in
   2853   (bfd *, const void *, Elf_Internal_Dyn *);
   2854 extern void bfd_elf64_swap_dyn_out
   2855   (bfd *, const Elf_Internal_Dyn *, void *);
   2856 extern long bfd_elf64_slurp_symbol_table
   2857   (bfd *, asymbol **, bool);
   2858 extern bool bfd_elf64_write_shdrs_and_ehdr
   2859   (bfd *);
   2860 extern int bfd_elf64_write_out_phdrs
   2861   (bfd *, const Elf_Internal_Phdr *, unsigned int);
   2862 extern bool bfd_elf64_checksum_contents
   2863   (bfd * , void (*) (const void *, size_t, void *), void *);
   2864 extern void bfd_elf64_write_relocs
   2865   (bfd *, asection *, void *);
   2866 extern bool bfd_elf64_slurp_reloc_table
   2867   (bfd *, asection *, asymbol **, bool);
   2868 
   2869 extern bool _bfd_elf_default_relocs_compatible
   2870   (const bfd_target *, const bfd_target *) ATTRIBUTE_HIDDEN;
   2871 
   2872 extern bool _bfd_elf_relocs_compatible
   2873   (const bfd_target *, const bfd_target *) ATTRIBUTE_HIDDEN;
   2874 extern bool _bfd_elf_notice_as_needed
   2875   (bfd *, struct bfd_link_info *, enum notice_asneeded_action) ATTRIBUTE_HIDDEN;
   2876 
   2877 extern struct bfd_link_hash_entry *_bfd_elf_archive_symbol_lookup
   2878   (bfd *, struct bfd_link_info *, const char *) ATTRIBUTE_HIDDEN;
   2879 extern bool bfd_elf_link_add_symbols
   2880   (bfd *, struct bfd_link_info *);
   2881 extern bool _bfd_elf_add_dynamic_entry
   2882   (struct bfd_link_info *, bfd_vma, bfd_vma) ATTRIBUTE_HIDDEN;
   2883 extern bool _bfd_elf_strip_zero_sized_dynamic_sections
   2884   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2885 extern int bfd_elf_add_dt_needed_tag
   2886   (bfd *, struct bfd_link_info *);
   2887 extern bool _bfd_elf_link_check_relocs
   2888   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2889 extern bool _bfd_elf_link_iterate_on_relocs
   2890   (bfd *, struct bfd_link_info *,
   2891    bool (*) (bfd *, struct bfd_link_info *, asection *,
   2892 	     const Elf_Internal_Rela *)) ATTRIBUTE_HIDDEN;
   2893 
   2894 extern bool bfd_elf_link_record_dynamic_symbol
   2895   (struct bfd_link_info *, struct elf_link_hash_entry *);
   2896 
   2897 extern int bfd_elf_link_record_local_dynamic_symbol
   2898   (struct bfd_link_info *, bfd *, long);
   2899 
   2900 extern bool _bfd_elf_free_cached_info
   2901   (bfd *) ATTRIBUTE_HIDDEN;
   2902 
   2903 extern bool _bfd_elf_common_definition
   2904   (Elf_Internal_Sym *) ATTRIBUTE_HIDDEN;
   2905 
   2906 extern unsigned int _bfd_elf_common_section_index
   2907   (asection *) ATTRIBUTE_HIDDEN;
   2908 
   2909 extern asection *_bfd_elf_common_section
   2910   (asection *) ATTRIBUTE_HIDDEN;
   2911 
   2912 extern bfd_vma _bfd_elf_default_got_elt_size
   2913   (bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, bfd *,
   2914    unsigned long) ATTRIBUTE_HIDDEN;
   2915 
   2916 extern bfd_reloc_status_type _bfd_elf_rel_vtable_reloc_fn
   2917   (bfd *, arelent *, struct bfd_symbol *, void *,
   2918    asection *, bfd *, char **) ATTRIBUTE_HIDDEN;
   2919 
   2920 extern bool _bfd_elf_final_link
   2921   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2922 
   2923 extern void _bfd_elf_gc_keep
   2924   (struct bfd_link_info *info) ATTRIBUTE_HIDDEN;
   2925 
   2926 extern bool bfd_elf_gc_mark_dynamic_ref_symbol
   2927   (struct elf_link_hash_entry *h, void *inf);
   2928 
   2929 extern bool bfd_elf_gc_sections
   2930   (bfd *, struct bfd_link_info *);
   2931 
   2932 extern bool bfd_elf_gc_record_vtinherit
   2933   (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
   2934 
   2935 extern bool bfd_elf_gc_record_vtentry
   2936   (bfd *, asection *, struct elf_link_hash_entry *, bfd_vma);
   2937 
   2938 extern asection *_bfd_elf_gc_mark_hook
   2939   (asection *, struct bfd_link_info *, struct elf_reloc_cookie *,
   2940    struct elf_link_hash_entry *, unsigned int) ATTRIBUTE_HIDDEN;
   2941 
   2942 extern asection *_bfd_elf_gc_mark_rsec
   2943   (struct bfd_link_info *, asection *, elf_gc_mark_hook_fn,
   2944    struct elf_reloc_cookie *, bool *) ATTRIBUTE_HIDDEN;
   2945 
   2946 extern bool _bfd_elf_gc_mark_reloc
   2947   (struct bfd_link_info *, asection *, elf_gc_mark_hook_fn,
   2948    struct elf_reloc_cookie *) ATTRIBUTE_HIDDEN;
   2949 
   2950 extern bool _bfd_elf_gc_mark_fdes
   2951   (struct bfd_link_info *, asection *, asection *, elf_gc_mark_hook_fn,
   2952    struct elf_reloc_cookie *) ATTRIBUTE_HIDDEN;
   2953 
   2954 extern bool _bfd_elf_gc_mark
   2955   (struct bfd_link_info *, asection *, elf_gc_mark_hook_fn) ATTRIBUTE_HIDDEN;
   2956 
   2957 extern bool _bfd_elf_gc_mark_extra_sections
   2958   (struct bfd_link_info *, elf_gc_mark_hook_fn) ATTRIBUTE_HIDDEN;
   2959 
   2960 extern bool bfd_elf_gc_common_finalize_got_offsets
   2961   (bfd *, struct bfd_link_info *);
   2962 
   2963 extern bool _bfd_elf_gc_common_final_link
   2964   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   2965 
   2966 extern bool bfd_elf_reloc_symbol_deleted_p
   2967   (bfd_vma, void *);
   2968 
   2969 extern struct elf_segment_map * _bfd_elf_make_dynamic_segment
   2970   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   2971 
   2972 extern bool bfd_elf_map_sections_to_segments
   2973   (bfd *, struct bfd_link_info *, bool *);
   2974 
   2975 extern bool _bfd_elf_is_function_type
   2976   (unsigned int) ATTRIBUTE_HIDDEN;
   2977 
   2978 extern bfd_size_type _bfd_elf_maybe_function_sym
   2979   (const asymbol *, asection *, bfd_vma *) ATTRIBUTE_HIDDEN;
   2980 
   2981 extern asection *_bfd_elf_plt_get_reloc_section
   2982   (bfd *, const char *) ATTRIBUTE_HIDDEN;
   2983 
   2984 extern int bfd_elf_get_default_section_type (flagword);
   2985 
   2986 extern bool bfd_elf_lookup_section_flags
   2987   (struct bfd_link_info *, struct flag_info *, asection *);
   2988 
   2989 extern Elf_Internal_Phdr * _bfd_elf_find_segment_containing_section
   2990   (bfd * abfd, asection * section) ATTRIBUTE_HIDDEN;
   2991 
   2992 /* PowerPC @tls opcode transform/validate.  */
   2993 extern unsigned int bfd_elf_ppc_at_tls_transform
   2994   (unsigned int, unsigned int);
   2995 /* PowerPC @tprel opcode transform/validate.  */
   2996 extern unsigned int _bfd_elf_ppc_at_tprel_transform
   2997   (unsigned int, unsigned int) ATTRIBUTE_HIDDEN;
   2998 /* PowerPC elf_object_p tweak.  */
   2999 extern bool _bfd_elf_ppc_set_arch
   3000   (bfd *) ATTRIBUTE_HIDDEN;
   3001 /* PowerPC .gnu.attributes handling common to both 32-bit and 64-bit.  */
   3002 extern bool _bfd_elf_ppc_merge_fp_attributes
   3003   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3004 
   3005 /* Return an upper bound on the number of bytes required to store a
   3006    copy of ABFD's program header table entries.  Return -1 if an error
   3007    occurs; bfd_get_error will return an appropriate code.  */
   3008 extern long bfd_get_elf_phdr_upper_bound
   3009   (bfd *abfd);
   3010 
   3011 /* Copy ABFD's program header table entries to *PHDRS.  The entries
   3012    will be stored as an array of Elf_Internal_Phdr structures, as
   3013    defined in include/elf/internal.h.  To find out how large the
   3014    buffer needs to be, call bfd_get_elf_phdr_upper_bound.
   3015 
   3016    Return the number of program header table entries read, or -1 if an
   3017    error occurs; bfd_get_error will return an appropriate code.  */
   3018 extern int bfd_get_elf_phdrs
   3019   (bfd *abfd, void *phdrs);
   3020 
   3021 /* Exported interface for writing elf corefile notes.  */
   3022 extern char *elfcore_write_note
   3023   (bfd *, char *, int *, const char *, int, const void *, int);
   3024 extern char *elfcore_write_prpsinfo
   3025   (bfd *, char *, int *, const char *, const char *);
   3026 extern char *elfcore_write_prstatus
   3027   (bfd *, char *, int *, long, int, const void *);
   3028 extern char * elfcore_write_pstatus
   3029   (bfd *, char *, int *, long, int, const void *);
   3030 extern char *elfcore_write_prfpreg
   3031   (bfd *, char *, int *, const void *, int);
   3032 extern char *elfcore_write_prxfpreg
   3033   (bfd *, char *, int *, const void *, int);
   3034 extern char *elfcore_write_xstatereg
   3035   (bfd *, char *, int *, const void *, int);
   3036 extern char *elfcore_write_xsave_layout
   3037   (bfd *, char *, int *, const void *, int);
   3038 extern char *elfcore_write_x86_segbases
   3039   (bfd *, char *, int *, const void *, int);
   3040 extern char *elfcore_write_i386_tls
   3041   (bfd *, char *, int *, const void *, int);
   3042 extern char *elfcore_write_ppc_vmx
   3043   (bfd *, char *, int *, const void *, int);
   3044 extern char *elfcore_write_ppc_vsx
   3045   (bfd *, char *, int *, const void *, int);
   3046 extern char *elfcore_write_ppc_tar
   3047   (bfd *, char *, int *, const void *, int);
   3048 extern char *elfcore_write_ppc_ppr
   3049   (bfd *, char *, int *, const void *, int);
   3050 extern char *elfcore_write_ppc_dscr
   3051   (bfd *, char *, int *, const void *, int);
   3052 extern char *elfcore_write_ppc_ebb
   3053   (bfd *, char *, int *, const void *, int);
   3054 extern char *elfcore_write_ppc_pmu
   3055   (bfd *, char *, int *, const void *, int);
   3056 extern char *elfcore_write_ppc_tm_cgpr
   3057   (bfd *, char *, int *, const void *, int);
   3058 extern char *elfcore_write_ppc_tm_cfpr
   3059   (bfd *, char *, int *, const void *, int);
   3060 extern char *elfcore_write_ppc_tm_cvmx
   3061   (bfd *, char *, int *, const void *, int);
   3062 extern char *elfcore_write_ppc_tm_cvsx
   3063   (bfd *, char *, int *, const void *, int);
   3064 extern char *elfcore_write_ppc_tm_spr
   3065   (bfd *, char *, int *, const void *, int);
   3066 extern char *elfcore_write_ppc_tm_ctar
   3067   (bfd *, char *, int *, const void *, int);
   3068 extern char *elfcore_write_ppc_tm_cppr
   3069   (bfd *, char *, int *, const void *, int);
   3070 extern char *elfcore_write_ppc_tm_cdscr
   3071   (bfd *, char *, int *, const void *, int);
   3072 extern char *elfcore_write_s390_timer
   3073   (bfd *, char *, int *, const void *, int);
   3074 extern char *elfcore_write_s390_todcmp
   3075   (bfd *, char *, int *, const void *, int);
   3076 extern char *elfcore_write_s390_todpreg
   3077   (bfd *, char *, int *, const void *, int);
   3078 extern char *elfcore_write_s390_ctrs
   3079   (bfd *, char *, int *, const void *, int);
   3080 extern char *elfcore_write_s390_prefix
   3081   (bfd *, char *, int *, const void *, int);
   3082 extern char *elfcore_write_s390_last_break
   3083   (bfd *, char *, int *, const void *, int);
   3084 extern char *elfcore_write_s390_system_call
   3085   (bfd *, char *, int *, const void *, int);
   3086 extern char *elfcore_write_s390_tdb
   3087   (bfd *, char *, int *, const void *, int);
   3088 extern char *elfcore_write_s390_vxrs_low
   3089   (bfd *, char *, int *, const void *, int);
   3090 extern char *elfcore_write_s390_vxrs_high
   3091   (bfd *, char *, int *, const void *, int);
   3092 extern char *elfcore_write_s390_gs_cb
   3093   (bfd *, char *, int *, const void *, int);
   3094 extern char *elfcore_write_s390_gs_bc
   3095   (bfd *, char *, int *, const void *, int);
   3096 extern char *elfcore_write_arm_vfp
   3097   (bfd *, char *, int *, const void *, int);
   3098 extern char *elfcore_write_aarch_tls
   3099   (bfd *, char *, int *, const void *, int);
   3100 extern char *elfcore_write_aarch_hw_break
   3101   (bfd *, char *, int *, const void *, int);
   3102 extern char *elfcore_write_aarch_hw_watch
   3103   (bfd *, char *, int *, const void *, int);
   3104 extern char *elfcore_write_aarch_sve
   3105   (bfd *, char *, int *, const void *, int);
   3106 extern char *elfcore_write_aarch_pauth
   3107   (bfd *, char *, int *, const void *, int);
   3108 extern char *elfcore_write_aarch_mte
   3109   (bfd *, char *, int *, const void *, int);
   3110 extern char *elfcore_write_aarch_ssve
   3111   (bfd *, char *, int *, const void *, int);
   3112 extern char *elfcore_write_aarch_za
   3113   (bfd *, char *, int *, const void *, int);
   3114 extern char *elfcore_write_aarch_zt
   3115   (bfd *, char *, int *, const void *, int);
   3116 extern char *elfcore_write_aarch_fpmr
   3117   (bfd *, char *, int *, const void *, int);
   3118 extern char *elfcore_write_arc_v2
   3119   (bfd *, char *, int *, const void *, int);
   3120 extern char *elfcore_write_riscv_csr
   3121   (bfd *, char *, int *, const void *, int);
   3122 extern char *elfcore_write_gdb_tdesc
   3123   (bfd *, char *, int *, const void *, int);
   3124 extern char *elfcore_write_lwpstatus
   3125   (bfd *, char *, int *, long, int, const void *);
   3126 extern char *elfcore_write_register_note
   3127   (bfd *, char *, int *, const char *, const void *, int);
   3128 extern char *elfcore_write_file_note
   3129   (bfd *, char *, int *, const void*, int);
   3130 extern char *elfcore_write_loongarch_cpucfg
   3131   (bfd *, char *, int *, const void*, int);
   3132 extern char *elfcore_write_loongarch_lbt
   3133   (bfd *, char *, int *, const void*, int);
   3134 extern char *elfcore_write_loongarch_lsx
   3135   (bfd *, char *, int *, const void*, int);
   3136 extern char *elfcore_write_loongarch_lasx
   3137   (bfd *, char *, int *, const void*, int);
   3138 
   3139 /* Internal structure which holds information to be included in the
   3140    PRPSINFO section of Linux core files.
   3141 
   3142    This is an "internal" structure in the sense that it should be used
   3143    to pass information to BFD (via the `elfcore_write_linux_prpsinfo'
   3144    function), so things like endianess shouldn't be an issue.  This
   3145    structure will eventually be converted in one of the
   3146    `elf_external_linux_*' structures and written out to an output bfd
   3147    by one of the functions declared below.  */
   3148 
   3149 struct elf_internal_linux_prpsinfo
   3150   {
   3151     char pr_state;			/* Numeric process state.  */
   3152     char pr_sname;			/* Char for pr_state.  */
   3153     char pr_zomb;			/* Zombie.  */
   3154     char pr_nice;			/* Nice val.  */
   3155     unsigned long pr_flag;		/* Flags.  */
   3156     unsigned int pr_uid;
   3157     unsigned int pr_gid;
   3158     int pr_pid, pr_ppid, pr_pgrp, pr_sid;
   3159     char pr_fname[16 + 1];		/* Filename of executable.  */
   3160     char pr_psargs[80 + 1];		/* Initial part of arg list.  */
   3161   };
   3162 
   3163 /* Linux/most 32-bit archs.  */
   3164 extern char *elfcore_write_linux_prpsinfo32
   3165   (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
   3166 
   3167 /* Linux/most 64-bit archs.  */
   3168 extern char *elfcore_write_linux_prpsinfo64
   3169   (bfd *, char *, int *, const struct elf_internal_linux_prpsinfo *);
   3170 
   3171 extern bfd *_bfd_elf32_bfd_from_remote_memory
   3172   (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
   3173    int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type))
   3174   ATTRIBUTE_HIDDEN;
   3175 extern bfd *_bfd_elf64_bfd_from_remote_memory
   3176   (bfd *templ, bfd_vma ehdr_vma, bfd_size_type size, bfd_vma *loadbasep,
   3177    int (*target_read_memory) (bfd_vma, bfd_byte *, bfd_size_type))
   3178   ATTRIBUTE_HIDDEN;
   3179 
   3180 extern obj_attr_version_t _bfd_obj_attrs_version_dec (uint8_t)
   3181   ATTRIBUTE_HIDDEN;
   3182 extern uint8_t _bfd_obj_attrs_version_enc (obj_attr_version_t)
   3183   ATTRIBUTE_HIDDEN;
   3184 extern bfd_vma bfd_elf_obj_attr_size (bfd *);
   3185 extern void bfd_elf_set_obj_attr_contents (bfd *, bfd_byte *, bfd_vma);
   3186 extern obj_attribute *
   3187 bfd_elf_new_obj_attr (bfd *, obj_attr_vendor_t, obj_attr_tag_t);
   3188 extern int bfd_elf_get_obj_attr_int (bfd *, obj_attr_vendor_t, obj_attr_tag_t);
   3189 extern obj_attribute *bfd_elf_add_obj_attr_int
   3190   (bfd *, obj_attr_vendor_t, obj_attr_tag_t, unsigned int);
   3191 #define bfd_elf_add_proc_attr_int(BFD, TAG, VALUE) \
   3192   bfd_elf_add_obj_attr_int ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
   3193 extern obj_attribute *bfd_elf_add_obj_attr_string
   3194   (bfd *, obj_attr_vendor_t, obj_attr_tag_t, const char *);
   3195 #define bfd_elf_add_proc_attr_string(BFD, TAG, VALUE) \
   3196   bfd_elf_add_obj_attr_string ((BFD), OBJ_ATTR_PROC, (TAG), (VALUE))
   3197 extern obj_attribute *bfd_elf_add_obj_attr_int_string
   3198   (bfd *, obj_attr_vendor_t, obj_attr_tag_t, unsigned int, const char *);
   3199 #define bfd_elf_add_proc_attr_int_string(BFD, TAG, INTVAL, STRVAL) \
   3200   bfd_elf_add_obj_attr_int_string ((BFD), OBJ_ATTR_PROC, (TAG), \
   3201 				   (INTVAL), (STRVAL))
   3202 
   3203 extern bool _bfd_elf_write_section_object_attributes
   3204   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3205 extern char *_bfd_elf_attr_strdup
   3206   (bfd *, const char *) ATTRIBUTE_HIDDEN;
   3207 extern void _bfd_elf_copy_obj_attributes
   3208   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
   3209 extern int bfd_elf_obj_attrs_arg_type
   3210   (bfd *, obj_attr_vendor_t, obj_attr_tag_t);
   3211 extern void _bfd_elf_parse_attributes
   3212   (bfd *, Elf_Internal_Shdr *) ATTRIBUTE_HIDDEN;
   3213 extern bfd *_bfd_elf_link_setup_object_attributes
   3214   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3215 extern bool _bfd_elf_merge_object_attributes
   3216   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3217 extern bool _bfd_elf_merge_unknown_attribute_low
   3218   (bfd *, bfd *, int) ATTRIBUTE_HIDDEN;
   3219 extern bool _bfd_elf_merge_unknown_attribute_list
   3220   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
   3221 extern Elf_Internal_Shdr *_bfd_elf_single_rel_hdr
   3222   (asection *sec);
   3223 extern bool _bfd_elf_read_notes
   3224   (bfd *, file_ptr, bfd_size_type, size_t) ATTRIBUTE_HIDDEN;
   3225 
   3226 extern obj_attr_v2_t *bfd_elf_obj_attr_v2_init (obj_attr_tag_t,
   3227   union obj_attr_value_v2);
   3228 extern void _bfd_elf_obj_attr_v2_free (obj_attr_v2_t *, obj_attr_encoding_v2_t)
   3229   ATTRIBUTE_HIDDEN;
   3230 extern obj_attr_v2_t *_bfd_elf_obj_attr_v2_copy (const obj_attr_v2_t *,
   3231   obj_attr_encoding_v2_t) ATTRIBUTE_HIDDEN;
   3232 extern int _bfd_elf_obj_attr_v2_cmp (const obj_attr_v2_t *,
   3233   const obj_attr_v2_t *) ATTRIBUTE_HIDDEN;
   3234 extern obj_attr_v2_t *bfd_obj_attr_v2_find_by_tag
   3235   (const obj_attr_subsection_v2_t *, obj_attr_tag_t, bool);
   3236 extern void bfd_obj_attr_subsection_v2_append
   3237   (obj_attr_subsection_v2_t *, obj_attr_v2_t *);
   3238 LINKED_LIST_MUTATIVE_OPS_PROTOTYPE (obj_attr_subsection_v2_t,
   3239 				    obj_attr_v2_t, ATTRIBUTE_HIDDEN);
   3240 LINKED_LIST_MERGE_SORT_PROTOTYPE_ (obj_attr_v2_t, ATTRIBUTE_HIDDEN);
   3241 LINKED_LIST_MERGE_SORT_PROTOTYPE (obj_attr_subsection_v2_t,
   3242 				  obj_attr_v2_t, ATTRIBUTE_HIDDEN);
   3243 extern obj_attr_subsection_v2_t *bfd_elf_obj_attr_subsection_v2_init
   3244   (const char *, obj_attr_subsection_scope_v2_t, bool, obj_attr_encoding_v2_t);
   3245 extern void _bfd_elf_obj_attr_subsection_v2_free (obj_attr_subsection_v2_t *)
   3246   ATTRIBUTE_HIDDEN;
   3247 extern int _bfd_elf_obj_attr_subsection_v2_cmp
   3248   (const obj_attr_subsection_v2_t *, const obj_attr_subsection_v2_t *)
   3249   ATTRIBUTE_HIDDEN;
   3250 extern obj_attr_subsection_v2_t *bfd_obj_attr_subsection_v2_find_by_name
   3251   (obj_attr_subsection_v2_t *, const char *, bool);
   3252 extern obj_attr_subsection_scope_v2_t bfd_elf_obj_attr_subsection_v2_scope
   3253   (const bfd *, const char *);
   3254 extern void bfd_obj_attr_subsection_v2_list_append
   3255   (obj_attr_subsection_list_t *, obj_attr_subsection_v2_t *);
   3256 extern obj_attr_subsection_v2_t *bfd_obj_attr_subsection_v2_list_remove
   3257   (obj_attr_subsection_list_t *, obj_attr_subsection_v2_t *);
   3258 LINKED_LIST_MUTATIVE_OPS_PROTOTYPE (obj_attr_subsection_list_t,
   3259 				    obj_attr_subsection_v2_t,
   3260 				    ATTRIBUTE_HIDDEN);
   3261 LINKED_LIST_MERGE_SORT_PROTOTYPE_ (obj_attr_subsection_v2_t, ATTRIBUTE_HIDDEN);
   3262 LINKED_LIST_MERGE_SORT_PROTOTYPE (obj_attr_subsection_list_t,
   3263 				  obj_attr_subsection_v2_t, ATTRIBUTE_HIDDEN);
   3264 
   3265 extern bool _bfd_elf_parse_gnu_properties
   3266   (bfd *, Elf_Internal_Note *) ATTRIBUTE_HIDDEN;
   3267 extern elf_property_list * _bfd_elf_find_property
   3268   (elf_property_list *, unsigned int, elf_property_list **) ATTRIBUTE_HIDDEN;
   3269 extern elf_property * _bfd_elf_get_property
   3270   (bfd *, unsigned int, unsigned int) ATTRIBUTE_HIDDEN;
   3271 extern bfd *_bfd_elf_link_setup_gnu_properties
   3272   (struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3273 extern bfd_size_type _bfd_elf_convert_gnu_property_size
   3274   (bfd *, bfd *) ATTRIBUTE_HIDDEN;
   3275 extern bool _bfd_elf_convert_gnu_properties
   3276   (bfd *, asection *, bfd *, bfd_byte **, bfd_size_type *) ATTRIBUTE_HIDDEN;
   3277 
   3278 /* The linker may need to keep track of the number of relocs that it
   3279    decides to copy as dynamic relocs in check_relocs for each symbol.
   3280    This is so that it can later discard them if they are found to be
   3281    unnecessary.  We can store the information in a field extending the
   3282    regular ELF linker hash table.  */
   3283 
   3284 struct elf_dyn_relocs
   3285 {
   3286   struct elf_dyn_relocs *next;
   3287 
   3288   /* The input section of the reloc.  */
   3289   asection *sec;
   3290 
   3291   /* Total number of relocs copied for the input section.  */
   3292   bfd_size_type count;
   3293 
   3294   /* Number of pc-relative relocs copied for the input section.  */
   3295   bfd_size_type pc_count;
   3296 };
   3297 
   3298 extern bool _bfd_elf_create_ifunc_sections
   3299   (bfd *, struct bfd_link_info *) ATTRIBUTE_HIDDEN;
   3300 extern bool _bfd_elf_allocate_ifunc_dyn_relocs
   3301   (struct bfd_link_info *, struct elf_link_hash_entry *,
   3302    struct elf_dyn_relocs **, unsigned int, unsigned int,
   3303    unsigned int, bool) ATTRIBUTE_HIDDEN;
   3304 
   3305 extern void _bfd_elf_append_rela
   3306   (bfd *, asection *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN;
   3307 extern void _bfd_elf_append_rel
   3308   (bfd *, asection *, Elf_Internal_Rela *) ATTRIBUTE_HIDDEN;
   3309 
   3310 extern bfd_vma elf64_r_info (bfd_vma, bfd_vma);
   3311 extern bfd_vma elf64_r_sym (bfd_vma);
   3312 extern bfd_vma elf32_r_info (bfd_vma, bfd_vma);
   3313 extern bfd_vma elf32_r_sym (bfd_vma);
   3314 
   3315 extern bool is_debuginfo_file (bfd *);
   3316 
   3317 
   3318 extern bool _bfd_elf_init_secondary_reloc_section
   3319   (bfd *, Elf_Internal_Shdr *, const char *, unsigned int) ATTRIBUTE_HIDDEN;
   3320 extern bool _bfd_elf_slurp_secondary_reloc_section
   3321   (bfd *, asection *, asymbol **, bool) ATTRIBUTE_HIDDEN;
   3322 extern bool _bfd_elf_copy_special_section_fields
   3323   (const bfd *, bfd *, const Elf_Internal_Shdr *, Elf_Internal_Shdr *)
   3324   ATTRIBUTE_HIDDEN;
   3325 extern bool _bfd_elf_write_secondary_reloc_section
   3326   (bfd *, asection *) ATTRIBUTE_HIDDEN;
   3327 extern unsigned int _bfd_elf_symbol_section_index
   3328   (bfd *, elf_symbol_type *) ATTRIBUTE_HIDDEN;
   3329 
   3330 extern asection *_bfd_elf_readonly_dynrelocs
   3331   (struct elf_link_hash_entry *) ATTRIBUTE_HIDDEN;
   3332 extern bool _bfd_elf_maybe_set_textrel
   3333   (struct elf_link_hash_entry *, void *) ATTRIBUTE_HIDDEN;
   3334 
   3335 extern bool _bfd_elf_add_dynamic_tags
   3336   (bfd *, struct bfd_link_info *, bool) ATTRIBUTE_HIDDEN;
   3337 
   3338 extern bool _bfd_elf_mmap_section_contents
   3339   (bfd *abfd, asection *section, bfd_byte **buf) ATTRIBUTE_HIDDEN;
   3340 extern void _bfd_elf_munmap_section_contents
   3341   (asection *, void *) ATTRIBUTE_HIDDEN;
   3342 extern bool _bfd_elf_link_mmap_section_contents
   3343   (bfd *abfd, asection *section, bfd_byte **buf) ATTRIBUTE_HIDDEN;
   3344 extern void _bfd_elf_link_munmap_section_contents
   3345   (asection *) ATTRIBUTE_HIDDEN;
   3346 
   3347 extern struct elf_link_hash_entry * _bfd_elf_get_link_hash_entry
   3348   (struct elf_link_hash_entry **, unsigned int, unsigned int, unsigned int)
   3349   ATTRIBUTE_HIDDEN;
   3350 extern asection *_bfd_get_local_sym_section
   3351   (struct elf_reloc_cookie *, unsigned int) ATTRIBUTE_HIDDEN;
   3352 
   3353 /* Large common section (x86 only).  */
   3354 extern asection bfd_elf_large_com_section;
   3355 
   3356 /* Hash for local symbol with the first section id, ID, in the input
   3357    file and the local symbol index, SYM.  */
   3358 #define ELF_LOCAL_SYMBOL_HASH(ID, SYM) \
   3359   (((((ID) & 0xffU) << 24) | (((ID) & 0xff00) << 8)) \
   3360    ^ (SYM) ^ (((ID) & 0xffff0000U) >> 16))
   3361 
   3362 /* This is the condition under which finish_dynamic_symbol will be called.
   3363    If our finish_dynamic_symbol isn't called, we'll need to do something
   3364    about initializing any .plt and .got entries in relocate_section.  */
   3365 #define WILL_CALL_FINISH_DYNAMIC_SYMBOL(DYN, SHARED, H) \
   3366   ((DYN)								\
   3367    && ((SHARED) || !(H)->forced_local)					\
   3368    && ((H)->dynindx != -1 || (H)->forced_local))
   3369 
   3370 /* This macro is to avoid lots of duplicated code in the body
   3371    of xxx_relocate_section() in the various elfxx-xxxx.c files.  */
   3372 #define RELOC_FOR_GLOBAL_SYMBOL(info, input_bfd, input_section, rel,	\
   3373 				r_symndx, symtab_hdr, sym_hashes,	\
   3374 				h, sec, relocation,			\
   3375 				unresolved_reloc, warned, ignored)	\
   3376   do									\
   3377     {									\
   3378       /* It seems this can happen with erroneous or unsupported		\
   3379 	 input (mixing a.out and elf in an archive, for example.)  */	\
   3380       if (sym_hashes == NULL)						\
   3381 	return false;							\
   3382 									\
   3383       h = sym_hashes[r_symndx - symtab_hdr->sh_info];			\
   3384 									\
   3385       if (info->wrap_hash != NULL					\
   3386 	  && (input_section->flags & SEC_DEBUGGING) != 0)		\
   3387 	{								\
   3388 	  struct bfd_link_hash_entry * new_h;				\
   3389 	  new_h = unwrap_hash_lookup (info, input_bfd, &h->root);	\
   3390 	  /* PR 31710: This lookup can fail if the input source has a	\
   3391 	     symbol that starts with __wrap_.  */			\
   3392 	  if (new_h != NULL)						\
   3393 	    h = (struct elf_link_hash_entry *) new_h;			\
   3394 	}								\
   3395 									\
   3396       while (h->root.type == bfd_link_hash_indirect			\
   3397 	     || h->root.type == bfd_link_hash_warning)			\
   3398 	h = (struct elf_link_hash_entry *) h->root.u.i.link;		\
   3399 									\
   3400       warned = false;							\
   3401       ignored = false;							\
   3402       unresolved_reloc = false;						\
   3403       relocation = 0;							\
   3404       if (h->root.type == bfd_link_hash_defined				\
   3405 	  || h->root.type == bfd_link_hash_defweak)			\
   3406 	{								\
   3407 	  sec = h->root.u.def.section;					\
   3408 	  if (sec == NULL						\
   3409 	      || sec->output_section == NULL)				\
   3410 	    /* Set a flag that will be cleared later if we find a	\
   3411 	       relocation value for this symbol.  output_section	\
   3412 	       is typically NULL for symbols satisfied by a shared	\
   3413 	       library.  */						\
   3414 	    unresolved_reloc = true;					\
   3415 	  else								\
   3416 	    relocation = (h->root.u.def.value				\
   3417 			  + sec->output_section->vma			\
   3418 			  + sec->output_offset);			\
   3419 	}								\
   3420       else if (h->root.type == bfd_link_hash_undefweak)			\
   3421 	;								\
   3422       else if (info->unresolved_syms_in_objects == RM_IGNORE		\
   3423 	       && ELF_ST_VISIBILITY (h->other) == STV_DEFAULT)		\
   3424 	ignored = true;							\
   3425       else if (!bfd_link_relocatable (info))				\
   3426 	{								\
   3427 	  bool err = ((info->unresolved_syms_in_objects == RM_DIAGNOSE	\
   3428 		       && !info->warn_unresolved_syms)			\
   3429 		      || ELF_ST_VISIBILITY (h->other) != STV_DEFAULT);	\
   3430 	  (*info->callbacks->undefined_symbol) (info,			\
   3431 						h->root.root.string,	\
   3432 						input_bfd,		\
   3433 						input_section,		\
   3434 						rel->r_offset, err);	\
   3435 	  warned = true;						\
   3436 	}								\
   3437       (void) unresolved_reloc;						\
   3438       (void) warned;							\
   3439       (void) ignored;							\
   3440     }									\
   3441   while (0)
   3442 
   3443 /* This macro is to avoid lots of duplicated code in the body of the
   3444    loop over relocations in xxx_relocate_section() in the various
   3445    elfxx-xxxx.c files.
   3446 
   3447    Handle relocations against symbols from removed linkonce sections,
   3448    or sections discarded by a linker script.  When doing a relocatable
   3449    link, we remove such relocations.  Otherwise, we just want the
   3450    section contents zeroed and avoid any special processing.  */
   3451 #define RELOC_AGAINST_DISCARDED_SECTION(info, input_bfd, input_section,	\
   3452 					rel, count, relend, rnone,	\
   3453 					howto, index, contents)		\
   3454   {									\
   3455     _bfd_clear_contents (howto, input_bfd, input_section,		\
   3456 			 contents, rel[index].r_offset);		\
   3457 									\
   3458     /* For ld -r, remove relocations in debug and sframe sections	\
   3459        against symbols defined in discarded sections.  Not done for	\
   3460        others.  In particular the .eh_frame editing code expects	\
   3461        such relocs to be present.  */					\
   3462     if (bfd_link_relocatable (info)					\
   3463 	&& ((input_section->flags & SEC_DEBUGGING) != 0			\
   3464 	    || elf_section_type (input_section) == SHT_GNU_SFRAME))	\
   3465       {									\
   3466 	Elf_Internal_Shdr *rel_hdr					\
   3467 	  = _bfd_elf_single_rel_hdr (input_section->output_section);	\
   3468 									\
   3469 	rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
   3470 	rel_hdr = _bfd_elf_single_rel_hdr (input_section);		\
   3471 	rel_hdr->sh_size -= rel_hdr->sh_entsize;			\
   3472 									\
   3473 	memmove (rel, rel + count,					\
   3474 		 (relend - rel - count) * sizeof (*rel));		\
   3475 									\
   3476 	input_section->reloc_count -= count;				\
   3477 	relend -= count;						\
   3478 	rel--;								\
   3479 	continue;							\
   3480       }									\
   3481 									\
   3482     for (int i_ = 0; i_ < count; i_++)					\
   3483       {									\
   3484 	rel[i_].r_info = rnone;						\
   3485 	rel[i_].r_addend = 0;						\
   3486       }									\
   3487     rel += count - 1;							\
   3488     continue;								\
   3489   }
   3490 
   3491 /* Will a symbol be bound to the definition within the shared
   3492    library, if any.  A unique symbol can never be bound locally.  */
   3493 #define SYMBOLIC_BIND(INFO, H) \
   3494     (!(H)->unique_global \
   3495      && ((INFO)->symbolic \
   3496 	 || (H)->start_stop \
   3497 	 || ((INFO)->dynamic && !(H)->dynamic)))
   3498 
   3499 /* Determine if a section contains CTF data, using its name.  */
   3500 static inline bool
   3501 bfd_section_is_ctf (const asection *sec)
   3502 {
   3503   const char *name = bfd_section_name (sec);
   3504   return startswith (name, ".ctf") && (name[4] == 0 || name[4] == '.');
   3505 }
   3506 
   3507 #ifdef __cplusplus
   3508 }
   3509 #endif
   3510 #endif /* _LIBELF_H_ */
   3511