Home | History | Annotate | Line # | Download | only in include
bfdlink.h revision 1.1.1.4.2.1
      1          1.1  christos /* bfdlink.h -- header file for BFD link routines
      2  1.1.1.4.2.1  pgoyette    Copyright (C) 1993-2016 Free Software Foundation, Inc.
      3          1.1  christos    Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
      4          1.1  christos 
      5          1.1  christos    This file is part of BFD, the Binary File Descriptor library.
      6          1.1  christos 
      7          1.1  christos    This program is free software; you can redistribute it and/or modify
      8          1.1  christos    it under the terms of the GNU General Public License as published by
      9          1.1  christos    the Free Software Foundation; either version 3 of the License, or
     10          1.1  christos    (at your option) any later version.
     11          1.1  christos 
     12          1.1  christos    This program is distributed in the hope that it will be useful,
     13          1.1  christos    but WITHOUT ANY WARRANTY; without even the implied warranty of
     14          1.1  christos    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15          1.1  christos    GNU General Public License for more details.
     16          1.1  christos 
     17          1.1  christos    You should have received a copy of the GNU General Public License
     18          1.1  christos    along with this program; if not, write to the Free Software
     19          1.1  christos    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
     20          1.1  christos    MA 02110-1301, USA.  */
     21          1.1  christos 
     22          1.1  christos #ifndef BFDLINK_H
     23          1.1  christos #define BFDLINK_H
     24          1.1  christos 
     25          1.1  christos /* Which symbols to strip during a link.  */
     26          1.1  christos enum bfd_link_strip
     27          1.1  christos {
     28          1.1  christos   strip_none,		/* Don't strip any symbols.  */
     29          1.1  christos   strip_debugger,	/* Strip debugging symbols.  */
     30          1.1  christos   strip_some,		/* keep_hash is the list of symbols to keep.  */
     31          1.1  christos   strip_all		/* Strip all symbols.  */
     32          1.1  christos };
     33          1.1  christos 
     34          1.1  christos /* Which local symbols to discard during a link.  This is irrelevant
     35          1.1  christos    if strip_all is used.  */
     36          1.1  christos enum bfd_link_discard
     37          1.1  christos {
     38          1.1  christos   discard_sec_merge,	/* Discard local temporary symbols in SEC_MERGE
     39          1.1  christos 			   sections.  */
     40          1.1  christos   discard_none,		/* Don't discard any locals.  */
     41          1.1  christos   discard_l,		/* Discard local temporary symbols.  */
     42          1.1  christos   discard_all		/* Discard all locals.  */
     43          1.1  christos };
     44          1.1  christos 
     45  1.1.1.4.2.1  pgoyette /* Whether to generate ELF common symbols with the STT_COMMON type
     46  1.1.1.4.2.1  pgoyette    during a relocatable link.  */
     47  1.1.1.4.2.1  pgoyette enum bfd_link_elf_stt_common
     48  1.1.1.4.2.1  pgoyette {
     49  1.1.1.4.2.1  pgoyette   unchanged,
     50  1.1.1.4.2.1  pgoyette   elf_stt_common,
     51  1.1.1.4.2.1  pgoyette   no_elf_stt_common
     52  1.1.1.4.2.1  pgoyette };
     53  1.1.1.4.2.1  pgoyette 
     54          1.1  christos /* Describes the type of hash table entry structure being used.
     55          1.1  christos    Different hash table structure have different fields and so
     56          1.1  christos    support different linking features.  */
     57          1.1  christos enum bfd_link_hash_table_type
     58          1.1  christos   {
     59          1.1  christos     bfd_link_generic_hash_table,
     60          1.1  christos     bfd_link_elf_hash_table
     61          1.1  christos   };
     62          1.1  christos 
     63          1.1  christos /* These are the possible types of an entry in the BFD link hash
     65          1.1  christos    table.  */
     66          1.1  christos 
     67          1.1  christos enum bfd_link_hash_type
     68          1.1  christos {
     69          1.1  christos   bfd_link_hash_new,		/* Symbol is new.  */
     70          1.1  christos   bfd_link_hash_undefined,	/* Symbol seen before, but undefined.  */
     71          1.1  christos   bfd_link_hash_undefweak,	/* Symbol is weak and undefined.  */
     72          1.1  christos   bfd_link_hash_defined,	/* Symbol is defined.  */
     73          1.1  christos   bfd_link_hash_defweak,	/* Symbol is weak and defined.  */
     74          1.1  christos   bfd_link_hash_common,		/* Symbol is common.  */
     75          1.1  christos   bfd_link_hash_indirect,	/* Symbol is an indirect link.  */
     76          1.1  christos   bfd_link_hash_warning		/* Like indirect, but warn if referenced.  */
     77          1.1  christos };
     78          1.1  christos 
     79          1.1  christos enum bfd_link_common_skip_ar_symbols
     80          1.1  christos {
     81          1.1  christos   bfd_link_common_skip_none,
     82          1.1  christos   bfd_link_common_skip_text,
     83          1.1  christos   bfd_link_common_skip_data,
     84          1.1  christos   bfd_link_common_skip_all
     85          1.1  christos };
     86          1.1  christos 
     87          1.1  christos struct bfd_link_hash_common_entry
     88          1.1  christos   {
     89          1.1  christos     unsigned int alignment_power;	/* Alignment.  */
     90          1.1  christos     asection *section;		/* Symbol section.  */
     91          1.1  christos   };
     92          1.1  christos 
     93          1.1  christos /* The linking routines use a hash table which uses this structure for
     94          1.1  christos    its elements.  */
     95          1.1  christos 
     96          1.1  christos struct bfd_link_hash_entry
     97          1.1  christos {
     98          1.1  christos   /* Base hash table entry structure.  */
     99          1.1  christos   struct bfd_hash_entry root;
    100          1.1  christos 
    101      1.1.1.2  christos   /* Type of this entry.  */
    102      1.1.1.2  christos   ENUM_BITFIELD (bfd_link_hash_type) type : 8;
    103      1.1.1.3  christos 
    104      1.1.1.3  christos   /* Symbol is referenced in a normal object file, as distict from a LTO
    105      1.1.1.2  christos      IR object file.  */
    106          1.1  christos   unsigned int non_ir_ref : 1;
    107      1.1.1.3  christos 
    108      1.1.1.3  christos   /* Symbol is a built-in define.  These will be overridden by PROVIDE
    109      1.1.1.3  christos      in a linker script.  */
    110      1.1.1.3  christos   unsigned int linker_def : 1;
    111  1.1.1.4.2.1  pgoyette 
    112  1.1.1.4.2.1  pgoyette   /* Symbol defined in a linker script.  */
    113  1.1.1.4.2.1  pgoyette   unsigned int ldscript_def : 1;
    114          1.1  christos 
    115          1.1  christos   /* A union of information depending upon the type.  */
    116          1.1  christos   union
    117          1.1  christos     {
    118          1.1  christos       /* Nothing is kept for bfd_hash_new.  */
    119          1.1  christos       /* bfd_link_hash_undefined, bfd_link_hash_undefweak.  */
    120          1.1  christos       struct
    121          1.1  christos 	{
    122          1.1  christos 	  /* Undefined and common symbols are kept in a linked list through
    123          1.1  christos 	     this field.  This field is present in all of the union element
    124          1.1  christos 	     so that we don't need to remove entries from the list when we
    125          1.1  christos 	     change their type.  Removing entries would either require the
    126          1.1  christos 	     list to be doubly linked, which would waste more memory, or
    127          1.1  christos 	     require a traversal.  When an undefined or common symbol is
    128          1.1  christos 	     created, it should be added to this list, the head of which is in
    129          1.1  christos 	     the link hash table itself.  As symbols are defined, they need
    130          1.1  christos 	     not be removed from the list; anything which reads the list must
    131          1.1  christos 	     doublecheck the symbol type.
    132          1.1  christos 
    133          1.1  christos 	     Weak symbols are not kept on this list.
    134          1.1  christos 
    135          1.1  christos 	     Defined and defweak symbols use this field as a reference marker.
    136          1.1  christos 	     If the field is not NULL, or this structure is the tail of the
    137          1.1  christos 	     undefined symbol list, the symbol has been referenced.  If the
    138          1.1  christos 	     symbol is undefined and becomes defined, this field will
    139          1.1  christos 	     automatically be non-NULL since the symbol will have been on the
    140          1.1  christos 	     undefined symbol list.  */
    141  1.1.1.4.2.1  pgoyette 	  struct bfd_link_hash_entry *next;
    142  1.1.1.4.2.1  pgoyette 	  /* BFD symbol was found in.  */
    143  1.1.1.4.2.1  pgoyette 	  bfd *abfd;
    144  1.1.1.4.2.1  pgoyette 	  /* For __start_<name> and __stop_<name> symbols, the first
    145  1.1.1.4.2.1  pgoyette 	     input section matching the name.  */
    146          1.1  christos 	  asection *section;
    147          1.1  christos 	} undef;
    148          1.1  christos       /* bfd_link_hash_defined, bfd_link_hash_defweak.  */
    149          1.1  christos       struct
    150          1.1  christos 	{
    151  1.1.1.4.2.1  pgoyette 	  struct bfd_link_hash_entry *next;
    152  1.1.1.4.2.1  pgoyette 	  /* Symbol section.  */
    153  1.1.1.4.2.1  pgoyette 	  asection *section;
    154  1.1.1.4.2.1  pgoyette 	  /* Symbol value.  */
    155          1.1  christos 	  bfd_vma value;
    156          1.1  christos 	} def;
    157          1.1  christos       /* bfd_link_hash_indirect, bfd_link_hash_warning.  */
    158          1.1  christos       struct
    159          1.1  christos 	{
    160  1.1.1.4.2.1  pgoyette 	  struct bfd_link_hash_entry *next;
    161  1.1.1.4.2.1  pgoyette 	  /* Real symbol.  */
    162  1.1.1.4.2.1  pgoyette 	  struct bfd_link_hash_entry *link;
    163  1.1.1.4.2.1  pgoyette 	  /* Warning message (bfd_link_hash_warning only).  */
    164          1.1  christos 	  const char *warning;
    165          1.1  christos 	} i;
    166          1.1  christos       /* bfd_link_hash_common.  */
    167          1.1  christos       struct
    168          1.1  christos 	{
    169          1.1  christos 	  struct bfd_link_hash_entry *next;
    170          1.1  christos 	  /* The linker needs to know three things about common
    171          1.1  christos 	     symbols: the size, the alignment, and the section in
    172          1.1  christos 	     which the symbol should be placed.  We store the size
    173          1.1  christos 	     here, and we allocate a small structure to hold the
    174          1.1  christos 	     section and the alignment.  The alignment is stored as a
    175          1.1  christos 	     power of two.  We don't store all the information
    176          1.1  christos 	     directly because we don't want to increase the size of
    177          1.1  christos 	     the union; this structure is a major space user in the
    178          1.1  christos 	     linker.  */
    179  1.1.1.4.2.1  pgoyette 	  struct bfd_link_hash_common_entry *p;
    180  1.1.1.4.2.1  pgoyette 	  /* Common symbol size.  */
    181          1.1  christos 	  bfd_size_type size;
    182          1.1  christos 	} c;
    183          1.1  christos     } u;
    184          1.1  christos };
    185          1.1  christos 
    186          1.1  christos /* This is the link hash table.  It is a derived class of
    187          1.1  christos    bfd_hash_table.  */
    188          1.1  christos 
    189          1.1  christos struct bfd_link_hash_table
    190          1.1  christos {
    191          1.1  christos   /* The hash table itself.  */
    192          1.1  christos   struct bfd_hash_table table;
    193          1.1  christos   /* A linked list of undefined and common symbols, linked through the
    194          1.1  christos      next field in the bfd_link_hash_entry structure.  */
    195          1.1  christos   struct bfd_link_hash_entry *undefs;
    196          1.1  christos   /* Entries are added to the tail of the undefs list.  */
    197      1.1.1.3  christos   struct bfd_link_hash_entry *undefs_tail;
    198      1.1.1.3  christos   /* Function to free the hash table on closing BFD.  */
    199          1.1  christos   void (*hash_table_free) (bfd *);
    200          1.1  christos   /* The type of the link hash table.  */
    201          1.1  christos   enum bfd_link_hash_table_type type;
    202          1.1  christos };
    203          1.1  christos 
    204          1.1  christos /* Look up an entry in a link hash table.  If FOLLOW is TRUE, this
    205          1.1  christos    follows bfd_link_hash_indirect and bfd_link_hash_warning links to
    206          1.1  christos    the real symbol.  */
    207          1.1  christos extern struct bfd_link_hash_entry *bfd_link_hash_lookup
    208          1.1  christos   (struct bfd_link_hash_table *, const char *, bfd_boolean create,
    209          1.1  christos    bfd_boolean copy, bfd_boolean follow);
    210          1.1  christos 
    211          1.1  christos /* Look up an entry in the main linker hash table if the symbol might
    212          1.1  christos    be wrapped.  This should only be used for references to an
    213          1.1  christos    undefined symbol, not for definitions of a symbol.  */
    214          1.1  christos 
    215          1.1  christos extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup
    216          1.1  christos   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
    217          1.1  christos    bfd_boolean, bfd_boolean);
    218      1.1.1.3  christos 
    219      1.1.1.3  christos /* If H is a wrapped symbol, ie. the symbol name starts with "__wrap_"
    220      1.1.1.3  christos    and the remainder is found in wrap_hash, return the real symbol.  */
    221      1.1.1.3  christos 
    222      1.1.1.3  christos extern struct bfd_link_hash_entry *unwrap_hash_lookup
    223      1.1.1.3  christos   (struct bfd_link_info *, bfd *, struct bfd_link_hash_entry *);
    224          1.1  christos 
    225          1.1  christos /* Traverse a link hash table.  */
    226          1.1  christos extern void bfd_link_hash_traverse
    227          1.1  christos   (struct bfd_link_hash_table *,
    228          1.1  christos     bfd_boolean (*) (struct bfd_link_hash_entry *, void *),
    229          1.1  christos     void *);
    230          1.1  christos 
    231          1.1  christos /* Add an entry to the undefs list.  */
    232          1.1  christos extern void bfd_link_add_undef
    233          1.1  christos   (struct bfd_link_hash_table *, struct bfd_link_hash_entry *);
    234          1.1  christos 
    235          1.1  christos /* Remove symbols from the undefs list that don't belong there.  */
    236          1.1  christos extern void bfd_link_repair_undef_list
    237          1.1  christos   (struct bfd_link_hash_table *table);
    238          1.1  christos 
    239          1.1  christos /* Read symbols and cache symbol pointer array in outsymbols.  */
    240          1.1  christos extern bfd_boolean bfd_generic_link_read_symbols (bfd *);
    241  1.1.1.4.2.1  pgoyette 
    242  1.1.1.4.2.1  pgoyette /* Check the relocs in the BFD.  Called after all the input
    243  1.1.1.4.2.1  pgoyette    files have been loaded, and garbage collection has tagged
    244  1.1.1.4.2.1  pgoyette    any unneeded sections.  */
    245  1.1.1.4.2.1  pgoyette extern bfd_boolean bfd_link_check_relocs (bfd *,struct bfd_link_info *);
    246          1.1  christos 
    247          1.1  christos struct bfd_sym_chain
    248          1.1  christos {
    249          1.1  christos   struct bfd_sym_chain *next;
    250          1.1  christos   const char *name;
    251          1.1  christos };
    252          1.1  christos 
    253          1.1  christos /* How to handle unresolved symbols.
    255          1.1  christos    There are four possibilities which are enumerated below:  */
    256          1.1  christos enum report_method
    257          1.1  christos {
    258          1.1  christos   /* This is the initial value when then link_info structure is created.
    259          1.1  christos      It allows the various stages of the linker to determine whether they
    260          1.1  christos      allowed to set the value.  */
    261          1.1  christos   RM_NOT_YET_SET = 0,
    262          1.1  christos   RM_IGNORE,
    263          1.1  christos   RM_GENERATE_WARNING,
    264          1.1  christos   RM_GENERATE_ERROR
    265      1.1.1.2  christos };
    266      1.1.1.2  christos 
    267      1.1.1.2  christos typedef enum {with_flags, without_flags} flag_type;
    268      1.1.1.2  christos 
    269      1.1.1.2  christos /* A section flag list.  */
    270      1.1.1.2  christos struct flag_info_list
    271      1.1.1.2  christos {
    272      1.1.1.2  christos   flag_type with;
    273      1.1.1.2  christos   const char *name;
    274      1.1.1.2  christos   bfd_boolean valid;
    275      1.1.1.2  christos   struct flag_info_list *next;
    276      1.1.1.2  christos };
    277      1.1.1.2  christos 
    278      1.1.1.2  christos /* Section flag info.  */
    279      1.1.1.2  christos struct flag_info
    280      1.1.1.2  christos {
    281      1.1.1.2  christos   flagword only_with_flags;
    282      1.1.1.2  christos   flagword not_with_flags;
    283      1.1.1.2  christos   struct flag_info_list *flag_list;
    284      1.1.1.2  christos   bfd_boolean flags_initialized;
    285          1.1  christos };
    286      1.1.1.2  christos 
    287          1.1  christos struct bfd_elf_dynamic_list;
    288  1.1.1.4.2.1  pgoyette struct bfd_elf_version_tree;
    289  1.1.1.4.2.1  pgoyette 
    290  1.1.1.4.2.1  pgoyette /* Types of output.  */
    291  1.1.1.4.2.1  pgoyette 
    292  1.1.1.4.2.1  pgoyette enum output_type
    293  1.1.1.4.2.1  pgoyette {
    294  1.1.1.4.2.1  pgoyette   type_pde,
    295  1.1.1.4.2.1  pgoyette   type_pie,
    296  1.1.1.4.2.1  pgoyette   type_relocatable,
    297  1.1.1.4.2.1  pgoyette   type_dll,
    298  1.1.1.4.2.1  pgoyette };
    299  1.1.1.4.2.1  pgoyette 
    300  1.1.1.4.2.1  pgoyette #define bfd_link_pde(info)	   ((info)->type == type_pde)
    301  1.1.1.4.2.1  pgoyette #define bfd_link_dll(info)	   ((info)->type == type_dll)
    302  1.1.1.4.2.1  pgoyette #define bfd_link_relocatable(info) ((info)->type == type_relocatable)
    303  1.1.1.4.2.1  pgoyette #define bfd_link_pie(info)	   ((info)->type == type_pie)
    304  1.1.1.4.2.1  pgoyette #define bfd_link_executable(info)  (bfd_link_pde (info) || bfd_link_pie (info))
    305          1.1  christos #define bfd_link_pic(info)	   (bfd_link_dll (info) || bfd_link_pie (info))
    306          1.1  christos 
    307          1.1  christos /* This structure holds all the information needed to communicate
    308          1.1  christos    between BFD and the linker when doing a link.  */
    309          1.1  christos 
    310  1.1.1.4.2.1  pgoyette struct bfd_link_info
    311  1.1.1.4.2.1  pgoyette {
    312          1.1  christos   /* Output type.  */
    313          1.1  christos   ENUM_BITFIELD (output_type) type : 2;
    314          1.1  christos 
    315          1.1  christos   /* TRUE if BFD should pre-bind symbols in a shared object.  */
    316      1.1.1.2  christos   unsigned int symbolic: 1;
    317      1.1.1.2  christos 
    318      1.1.1.2  christos   /* TRUE if executable should not contain copy relocs.
    319      1.1.1.2  christos      Setting this true may result in a non-sharable text segment.  */
    320          1.1  christos   unsigned int nocopyreloc: 1;
    321          1.1  christos 
    322          1.1  christos   /* TRUE if BFD should export all symbols in the dynamic symbol table
    323          1.1  christos      of an executable, rather than only those used.  */
    324          1.1  christos   unsigned int export_dynamic: 1;
    325          1.1  christos 
    326          1.1  christos   /* TRUE if a default symbol version should be created and used for
    327          1.1  christos      exported symbols.  */
    328      1.1.1.2  christos   unsigned int create_default_symver: 1;
    329      1.1.1.2  christos 
    330          1.1  christos   /* TRUE if unreferenced sections should be removed.  */
    331          1.1  christos   unsigned int gc_sections: 1;
    332          1.1  christos 
    333          1.1  christos   /* TRUE if every symbol should be reported back via the notice
    334          1.1  christos      callback.  */
    335      1.1.1.3  christos   unsigned int notice_all: 1;
    336      1.1.1.3  christos 
    337      1.1.1.3  christos   /* TRUE if the LTO plugin is active.  */
    338      1.1.1.2  christos   unsigned int lto_plugin_active: 1;
    339      1.1.1.2  christos 
    340          1.1  christos   /* TRUE if global symbols in discarded sections should be stripped.  */
    341      1.1.1.2  christos   unsigned int strip_discarded: 1;
    342      1.1.1.2  christos 
    343          1.1  christos   /* TRUE if all data symbols should be dynamic.  */
    344      1.1.1.2  christos   unsigned int dynamic_data: 1;
    345      1.1.1.2  christos 
    346          1.1  christos   /* Which symbols to strip.  */
    347      1.1.1.2  christos   ENUM_BITFIELD (bfd_link_strip) strip : 2;
    348      1.1.1.2  christos 
    349          1.1  christos   /* Which local symbols to discard.  */
    350  1.1.1.4.2.1  pgoyette   ENUM_BITFIELD (bfd_link_discard) discard : 2;
    351  1.1.1.4.2.1  pgoyette 
    352  1.1.1.4.2.1  pgoyette   /* Whether to generate ELF common symbols with the STT_COMMON type.  */
    353      1.1.1.2  christos   ENUM_BITFIELD (bfd_link_elf_stt_common) elf_stt_common : 2;
    354      1.1.1.2  christos 
    355      1.1.1.2  christos   /* Criteria for skipping symbols when determining
    356          1.1  christos      whether to include an object from an archive. */
    357      1.1.1.2  christos   ENUM_BITFIELD (bfd_link_common_skip_ar_symbols) common_skip_ar_symbols : 2;
    358      1.1.1.2  christos 
    359      1.1.1.2  christos   /* What to do with unresolved symbols in an object file.
    360      1.1.1.2  christos      When producing executables the default is GENERATE_ERROR.
    361      1.1.1.2  christos      When producing shared libraries the default is IGNORE.  The
    362      1.1.1.2  christos      assumption with shared libraries is that the reference will be
    363          1.1  christos      resolved at load/execution time.  */
    364      1.1.1.2  christos   ENUM_BITFIELD (report_method) unresolved_syms_in_objects : 2;
    365      1.1.1.2  christos 
    366      1.1.1.2  christos   /* What to do with unresolved symbols in a shared library.
    367          1.1  christos      The same defaults apply.  */
    368      1.1.1.2  christos   ENUM_BITFIELD (report_method) unresolved_syms_in_shared_libs : 2;
    369      1.1.1.2  christos 
    370      1.1.1.2  christos   /* TRUE if shared objects should be linked directly, not shared.  */
    371      1.1.1.2  christos   unsigned int static_link: 1;
    372      1.1.1.2  christos 
    373      1.1.1.2  christos   /* TRUE if symbols should be retained in memory, FALSE if they
    374      1.1.1.2  christos      should be freed and reread.  */
    375      1.1.1.2  christos   unsigned int keep_memory: 1;
    376      1.1.1.2  christos 
    377      1.1.1.2  christos   /* TRUE if BFD should generate relocation information in the final
    378          1.1  christos      executable.  */
    379          1.1  christos   unsigned int emitrelocations: 1;
    380          1.1  christos 
    381          1.1  christos   /* TRUE if PT_GNU_RELRO segment should be created.  */
    382      1.1.1.4  christos   unsigned int relro: 1;
    383      1.1.1.4  christos 
    384      1.1.1.4  christos   /* Nonzero if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
    385      1.1.1.2  christos      should be created.  1 for DWARF2 tables, 2 for compact tables.  */
    386          1.1  christos   unsigned int eh_frame_hdr_type: 2;
    387          1.1  christos 
    388          1.1  christos   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
    389      1.1.1.2  christos   unsigned int warn_shared_textrel: 1;
    390      1.1.1.2  christos 
    391          1.1  christos   /* TRUE if we should error when adding a DT_TEXTREL.  */
    392          1.1  christos   unsigned int error_textrel: 1;
    393          1.1  christos 
    394          1.1  christos   /* TRUE if .hash section should be created.  */
    395          1.1  christos   unsigned int emit_hash: 1;
    396          1.1  christos 
    397          1.1  christos   /* TRUE if .gnu.hash section should be created.  */
    398          1.1  christos   unsigned int emit_gnu_hash: 1;
    399          1.1  christos 
    400          1.1  christos   /* If TRUE reduce memory overheads, at the expense of speed. This will
    401          1.1  christos      cause map file generation to use an O(N^2) algorithm and disable
    402          1.1  christos      caching ELF symbol buffer.  */
    403      1.1.1.2  christos   unsigned int reduce_memory_overheads: 1;
    404      1.1.1.2  christos 
    405      1.1.1.2  christos   /* TRUE if the output file should be in a traditional format.  This
    406      1.1.1.2  christos      is equivalent to the setting of the BFD_TRADITIONAL_FORMAT flag
    407      1.1.1.2  christos      on the output file, but may be checked when reading the input
    408      1.1.1.2  christos      files.  */
    409      1.1.1.2  christos   unsigned int traditional_format: 1;
    410      1.1.1.2  christos 
    411      1.1.1.2  christos   /* TRUE if non-PLT relocs should be merged into one reloc section
    412      1.1.1.2  christos      and sorted so that relocs against the same symbol come together.  */
    413      1.1.1.2  christos   unsigned int combreloc: 1;
    414      1.1.1.2  christos 
    415      1.1.1.2  christos   /* TRUE if a default symbol version should be created and used for
    416      1.1.1.2  christos      imported symbols.  */
    417      1.1.1.2  christos   unsigned int default_imported_symver: 1;
    418      1.1.1.2  christos 
    419      1.1.1.2  christos   /* TRUE if the new ELF dynamic tags are enabled. */
    420      1.1.1.2  christos   unsigned int new_dtags: 1;
    421      1.1.1.2  christos 
    422      1.1.1.2  christos   /* FALSE if .eh_frame unwind info should be generated for PLT and other
    423      1.1.1.2  christos      linker created sections, TRUE if it should be omitted.  */
    424      1.1.1.2  christos   unsigned int no_ld_generated_unwind_info: 1;
    425      1.1.1.2  christos 
    426      1.1.1.2  christos   /* TRUE if BFD should generate a "task linked" object file,
    427      1.1.1.2  christos      similar to relocatable but also with globals converted to
    428      1.1.1.2  christos      statics.  */
    429      1.1.1.2  christos   unsigned int task_link: 1;
    430      1.1.1.2  christos 
    431      1.1.1.2  christos   /* TRUE if ok to have multiple definition.  */
    432      1.1.1.2  christos   unsigned int allow_multiple_definition: 1;
    433      1.1.1.2  christos 
    434          1.1  christos   /* TRUE if ok to have version with no definition.  */
    435          1.1  christos   unsigned int allow_undefined_version: 1;
    436          1.1  christos 
    437          1.1  christos   /* TRUE if some symbols have to be dynamic, controlled by
    438          1.1  christos      --dynamic-list command line options.  */
    439      1.1.1.2  christos   unsigned int dynamic: 1;
    440      1.1.1.2  christos 
    441      1.1.1.2  christos   /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W|PF_X
    442          1.1  christos      flags.  */
    443      1.1.1.2  christos   unsigned int execstack: 1;
    444      1.1.1.2  christos 
    445      1.1.1.2  christos   /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W
    446          1.1  christos      flags.  */
    447      1.1.1.2  christos   unsigned int noexecstack: 1;
    448      1.1.1.2  christos 
    449      1.1.1.2  christos   /* TRUE if we want to produced optimized output files.  This might
    450          1.1  christos      need much more time and therefore must be explicitly selected.  */
    451      1.1.1.2  christos   unsigned int optimize: 1;
    452      1.1.1.2  christos 
    453          1.1  christos   /* TRUE if user should be informed of removed unreferenced sections.  */
    454      1.1.1.2  christos   unsigned int print_gc_sections: 1;
    455      1.1.1.2  christos 
    456          1.1  christos   /* TRUE if we should warn alternate ELF machine code.  */
    457      1.1.1.2  christos   unsigned int warn_alternate_em: 1;
    458      1.1.1.2  christos 
    459          1.1  christos   /* TRUE if the linker script contained an explicit PHDRS command.  */
    460  1.1.1.4.2.1  pgoyette   unsigned int user_phdrs: 1;
    461  1.1.1.4.2.1  pgoyette 
    462  1.1.1.4.2.1  pgoyette   /* TRUE if we should check relocations after all input files have
    463  1.1.1.4.2.1  pgoyette      been opened.  */
    464      1.1.1.3  christos   unsigned int check_relocs_after_open_input: 1;
    465      1.1.1.3  christos 
    466      1.1.1.3  christos   /* TRUE if BND prefix in PLT entries is always generated.  */
    467  1.1.1.4.2.1  pgoyette   unsigned int bndplt: 1;
    468  1.1.1.4.2.1  pgoyette 
    469  1.1.1.4.2.1  pgoyette   /* TRUE if generation of .interp/PT_INTERP should be suppressed.  */
    470  1.1.1.4.2.1  pgoyette   unsigned int nointerp: 1;
    471  1.1.1.4.2.1  pgoyette 
    472  1.1.1.4.2.1  pgoyette   /* TRUE if we shouldn't check relocation overflow.  */
    473  1.1.1.4.2.1  pgoyette   unsigned int no_reloc_overflow_check: 1;
    474  1.1.1.4.2.1  pgoyette 
    475  1.1.1.4.2.1  pgoyette   /* TRUE if generate a 1-byte NOP as suffix for x86 call instruction.  */
    476  1.1.1.4.2.1  pgoyette   unsigned int call_nop_as_suffix : 1;
    477  1.1.1.4.2.1  pgoyette 
    478  1.1.1.4.2.1  pgoyette   /* The 1-byte NOP for x86 call instruction.  */
    479          1.1  christos   char call_nop_byte;
    480          1.1  christos 
    481          1.1  christos   /* Char that may appear as the first char of a symbol, but should be
    482          1.1  christos      skipped (like symbol_leading_char) when looking up symbols in
    483          1.1  christos      wrap_hash.  Used by PowerPC Linux for 'dot' symbols.  */
    484          1.1  christos   char wrap_char;
    485          1.1  christos 
    486          1.1  christos   /* Separator between archive and filename in linker script filespecs.  */
    487      1.1.1.4  christos   char path_separator;
    488      1.1.1.4  christos 
    489      1.1.1.4  christos   /* Compress DWARF debug sections.  */
    490      1.1.1.2  christos   enum compressed_debug_section_type compress_debug;
    491      1.1.1.2  christos 
    492      1.1.1.2  christos   /* Default stack size.  Zero means default (often zero itself), -1
    493      1.1.1.2  christos      means explicitly zero-sized.  */
    494      1.1.1.2  christos   bfd_signed_vma stacksize;
    495      1.1.1.2  christos 
    496      1.1.1.2  christos   /* Enable or disable target specific optimizations.
    497      1.1.1.2  christos 
    498      1.1.1.2  christos      Not all targets have optimizations to enable.
    499      1.1.1.2  christos 
    500      1.1.1.2  christos      Normally these optimizations are disabled by default but some targets
    501      1.1.1.2  christos      prefer to enable them by default.  So this field is a tri-state variable.
    502      1.1.1.2  christos      The values are:
    503      1.1.1.2  christos 
    504      1.1.1.2  christos      zero: Enable the optimizations (either from --relax being specified on
    505      1.1.1.2  christos        the command line or the backend's before_allocation emulation function.
    506      1.1.1.2  christos 
    507      1.1.1.2  christos      positive: The user has requested that these optimizations be disabled.
    508      1.1.1.2  christos        (Via the --no-relax command line option).
    509      1.1.1.2  christos 
    510      1.1.1.2  christos      negative: The optimizations are disabled.  (Set when initializing the
    511      1.1.1.2  christos        args_type structure in ldmain.c:main.  */
    512          1.1  christos   signed int disable_target_specific_optimizations;
    513          1.1  christos 
    514          1.1  christos   /* Function callbacks.  */
    515          1.1  christos   const struct bfd_link_callbacks *callbacks;
    516          1.1  christos 
    517          1.1  christos   /* Hash table handled by BFD.  */
    518          1.1  christos   struct bfd_link_hash_table *hash;
    519          1.1  christos 
    520          1.1  christos   /* Hash table of symbols to keep.  This is NULL unless strip is
    521          1.1  christos      strip_some.  */
    522          1.1  christos   struct bfd_hash_table *keep_hash;
    523          1.1  christos 
    524          1.1  christos   /* Hash table of symbols to report back via the notice callback.  If
    525          1.1  christos      this is NULL, and notice_all is FALSE, then no symbols are
    526          1.1  christos      reported back.  */
    527          1.1  christos   struct bfd_hash_table *notice_hash;
    528          1.1  christos 
    529          1.1  christos   /* Hash table of symbols which are being wrapped (the --wrap linker
    530          1.1  christos      option).  If this is NULL, no symbols are being wrapped.  */
    531      1.1.1.2  christos   struct bfd_hash_table *wrap_hash;
    532      1.1.1.2  christos 
    533      1.1.1.2  christos   /* Hash table of symbols which may be left unresolved during
    534      1.1.1.2  christos      a link.  If this is NULL, no symbols can be left unresolved.  */
    535          1.1  christos   struct bfd_hash_table *ignore_hash;
    536          1.1  christos 
    537          1.1  christos   /* The output BFD.  */
    538  1.1.1.4.2.1  pgoyette   bfd *output_bfd;
    539  1.1.1.4.2.1  pgoyette 
    540  1.1.1.4.2.1  pgoyette   /* The import library generated.  */
    541          1.1  christos   bfd *out_implib_bfd;
    542      1.1.1.3  christos 
    543          1.1  christos   /* The list of input BFD's involved in the link.  These are chained
    544          1.1  christos      together via the link.next field.  */
    545          1.1  christos   bfd *input_bfds;
    546          1.1  christos   bfd **input_bfds_tail;
    547          1.1  christos 
    548          1.1  christos   /* If a symbol should be created for each input BFD, this is section
    549          1.1  christos      where those symbols should be placed.  It must be a section in
    550          1.1  christos      the output BFD.  It may be NULL, in which case no such symbols
    551          1.1  christos      will be created.  This is to support CREATE_OBJECT_SYMBOLS in the
    552          1.1  christos      linker command language.  */
    553          1.1  christos   asection *create_object_symbols_section;
    554          1.1  christos 
    555          1.1  christos   /* List of global symbol names that are starting points for marking
    556          1.1  christos      sections against garbage collection.  */
    557          1.1  christos   struct bfd_sym_chain *gc_sym_list;
    558          1.1  christos 
    559          1.1  christos   /* If a base output file is wanted, then this points to it */
    560          1.1  christos   void *base_file;
    561          1.1  christos 
    562          1.1  christos   /* The function to call when the executable or shared object is
    563          1.1  christos      loaded.  */
    564          1.1  christos   const char *init_function;
    565          1.1  christos 
    566          1.1  christos   /* The function to call when the executable or shared object is
    567          1.1  christos      unloaded.  */
    568          1.1  christos   const char *fini_function;
    569          1.1  christos 
    570          1.1  christos   /* Number of relaxation passes.  Usually only one relaxation pass
    571          1.1  christos      is needed.  But a backend can have as many relaxation passes as
    572          1.1  christos      necessary.  During bfd_relax_section call, it is set to the
    573          1.1  christos      current pass, starting from 0.  */
    574          1.1  christos   int relax_pass;
    575          1.1  christos 
    576          1.1  christos   /* Number of relaxation trips.  This number is incremented every
    577          1.1  christos      time the relaxation pass is restarted due to a previous
    578          1.1  christos      relaxation returning true in *AGAIN.  */
    579      1.1.1.4  christos   int relax_trip;
    580      1.1.1.4  christos 
    581      1.1.1.4  christos   /* > 0 to treat protected data defined in the shared library as
    582      1.1.1.4  christos      reference external.  0 to treat it as internal.  -1 to let
    583      1.1.1.4  christos      backend to decide.  */
    584  1.1.1.4.2.1  pgoyette   int extern_protected_data;
    585  1.1.1.4.2.1  pgoyette 
    586  1.1.1.4.2.1  pgoyette   /* > 0 to treat undefined weak symbol in the executable as dynamic,
    587  1.1.1.4.2.1  pgoyette      requiring dynamic relocation.  */
    588          1.1  christos   int dynamic_undefined_weak;
    589          1.1  christos 
    590          1.1  christos   /* Non-zero if auto-import thunks for DATA items in pei386 DLLs
    591          1.1  christos      should be generated/linked against.  Set to 1 if this feature
    592          1.1  christos      is explicitly requested by the user, -1 if enabled by default.  */
    593          1.1  christos   int pei386_auto_import;
    594          1.1  christos 
    595          1.1  christos   /* Non-zero if runtime relocs for DATA items with non-zero addends
    596          1.1  christos      in pei386 DLLs should be generated.  Set to 1 if this feature
    597          1.1  christos      is explicitly requested by the user, -1 if enabled by default.  */
    598          1.1  christos   int pei386_runtime_pseudo_reloc;
    599          1.1  christos 
    600          1.1  christos   /* How many spare .dynamic DT_NULL entries should be added?  */
    601          1.1  christos   unsigned int spare_dynamic_tags;
    602          1.1  christos 
    603          1.1  christos   /* May be used to set DT_FLAGS for ELF. */
    604          1.1  christos   bfd_vma flags;
    605          1.1  christos 
    606          1.1  christos   /* May be used to set DT_FLAGS_1 for ELF. */
    607          1.1  christos   bfd_vma flags_1;
    608          1.1  christos 
    609          1.1  christos   /* Start and end of RELRO region.  */
    610          1.1  christos   bfd_vma relro_start, relro_end;
    611          1.1  christos 
    612      1.1.1.2  christos   /* List of symbols should be dynamic.  */
    613      1.1.1.2  christos   struct bfd_elf_dynamic_list *dynamic_list;
    614      1.1.1.2  christos 
    615          1.1  christos   /* The version information.  */
    616          1.1  christos   struct bfd_elf_version_tree *version_info;
    617          1.1  christos };
    618  1.1.1.4.2.1  pgoyette 
    619          1.1  christos /* This structures holds a set of callback functions.  These are called
    620          1.1  christos    by the BFD linker routines.  */
    621          1.1  christos 
    622          1.1  christos struct bfd_link_callbacks
    623          1.1  christos {
    624          1.1  christos   /* A function which is called when an object is added from an
    625          1.1  christos      archive.  ABFD is the archive element being added.  NAME is the
    626          1.1  christos      name of the symbol which caused the archive element to be pulled
    627  1.1.1.4.2.1  pgoyette      in.  This function may set *SUBSBFD to point to an alternative
    628  1.1.1.4.2.1  pgoyette      BFD from which symbols should in fact be added in place of the
    629          1.1  christos      original BFD's symbols.  Returns TRUE if the object should be
    630          1.1  christos      added, FALSE if it should be skipped.  */
    631          1.1  christos   bfd_boolean (*add_archive_element)
    632      1.1.1.2  christos     (struct bfd_link_info *, bfd *abfd, const char *name, bfd **subsbfd);
    633      1.1.1.2  christos   /* A function which is called when a symbol is found with multiple
    634      1.1.1.2  christos      definitions.  H is the symbol which is defined multiple times.
    635  1.1.1.4.2.1  pgoyette      NBFD is the new BFD, NSEC is the new section, and NVAL is the new
    636      1.1.1.2  christos      value.  NSEC may be bfd_com_section or bfd_ind_section.  */
    637          1.1  christos   void (*multiple_definition)
    638          1.1  christos     (struct bfd_link_info *, struct bfd_link_hash_entry *h,
    639      1.1.1.2  christos      bfd *nbfd, asection *nsec, bfd_vma nval);
    640          1.1  christos   /* A function which is called when a common symbol is defined
    641          1.1  christos      multiple times.  H is the symbol appearing multiple times.
    642          1.1  christos      NBFD is the BFD of the new symbol.  NTYPE is the type of the new
    643          1.1  christos      symbol, one of bfd_link_hash_defined, bfd_link_hash_common, or
    644  1.1.1.4.2.1  pgoyette      bfd_link_hash_indirect.  If NTYPE is bfd_link_hash_common, NSIZE
    645      1.1.1.2  christos      is the size of the new symbol.  */
    646          1.1  christos   void (*multiple_common)
    647          1.1  christos     (struct bfd_link_info *, struct bfd_link_hash_entry *h,
    648          1.1  christos      bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize);
    649          1.1  christos   /* A function which is called to add a symbol to a set.  ENTRY is
    650          1.1  christos      the link hash table entry for the set itself (e.g.,
    651          1.1  christos      __CTOR_LIST__).  RELOC is the relocation to use for an entry in
    652          1.1  christos      the set when generating a relocatable file, and is also used to
    653  1.1.1.4.2.1  pgoyette      get the size of the entry when generating an executable file.
    654          1.1  christos      ABFD, SEC and VALUE identify the value to add to the set.  */
    655          1.1  christos   void (*add_to_set)
    656          1.1  christos     (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
    657          1.1  christos      bfd_reloc_code_real_type reloc, bfd *abfd, asection *sec, bfd_vma value);
    658          1.1  christos   /* A function which is called when the name of a g++ constructor or
    659          1.1  christos      destructor is found.  This is only called by some object file
    660          1.1  christos      formats.  CONSTRUCTOR is TRUE for a constructor, FALSE for a
    661          1.1  christos      destructor.  This will use BFD_RELOC_CTOR when generating a
    662  1.1.1.4.2.1  pgoyette      relocatable file.  NAME is the name of the symbol found.  ABFD,
    663          1.1  christos      SECTION and VALUE are the value of the symbol.  */
    664          1.1  christos   void (*constructor)
    665          1.1  christos     (struct bfd_link_info *, bfd_boolean constructor, const char *name,
    666          1.1  christos      bfd *abfd, asection *sec, bfd_vma value);
    667          1.1  christos   /* A function which is called to issue a linker warning.  For
    668          1.1  christos      example, this is called when there is a reference to a warning
    669          1.1  christos      symbol.  WARNING is the warning to be issued.  SYMBOL is the name
    670          1.1  christos      of the symbol which triggered the warning; it may be NULL if
    671          1.1  christos      there is none.  ABFD, SECTION and ADDRESS identify the location
    672  1.1.1.4.2.1  pgoyette      which trigerred the warning; either ABFD or SECTION or both may
    673          1.1  christos      be NULL if the location is not known.  */
    674          1.1  christos   void (*warning)
    675          1.1  christos     (struct bfd_link_info *, const char *warning, const char *symbol,
    676          1.1  christos      bfd *abfd, asection *section, bfd_vma address);
    677          1.1  christos   /* A function which is called when a relocation is attempted against
    678          1.1  christos      an undefined symbol.  NAME is the symbol which is undefined.
    679          1.1  christos      ABFD, SECTION and ADDRESS identify the location from which the
    680  1.1.1.4.2.1  pgoyette      reference is made. IS_FATAL indicates whether an undefined symbol is
    681          1.1  christos      a fatal error or not. In some cases SECTION may be NULL.  */
    682          1.1  christos   void (*undefined_symbol)
    683          1.1  christos     (struct bfd_link_info *, const char *name, bfd *abfd,
    684          1.1  christos      asection *section, bfd_vma address, bfd_boolean is_fatal);
    685          1.1  christos   /* A function which is called when a reloc overflow occurs. ENTRY is
    686          1.1  christos      the link hash table entry for the symbol the reloc is against.
    687          1.1  christos      NAME is the name of the local symbol or section the reloc is
    688          1.1  christos      against, RELOC_NAME is the name of the relocation, and ADDEND is
    689          1.1  christos      any addend that is used.  ABFD, SECTION and ADDRESS identify the
    690          1.1  christos      location at which the overflow occurs; if this is the result of a
    691  1.1.1.4.2.1  pgoyette      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    692          1.1  christos      ABFD will be NULL.  */
    693          1.1  christos   void (*reloc_overflow)
    694          1.1  christos     (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
    695          1.1  christos      const char *name, const char *reloc_name, bfd_vma addend,
    696          1.1  christos      bfd *abfd, asection *section, bfd_vma address);
    697          1.1  christos   /* A function which is called when a dangerous reloc is performed.
    698          1.1  christos      MESSAGE is an appropriate message.
    699          1.1  christos      ABFD, SECTION and ADDRESS identify the location at which the
    700          1.1  christos      problem occurred; if this is the result of a
    701  1.1.1.4.2.1  pgoyette      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    702          1.1  christos      ABFD will be NULL.  */
    703          1.1  christos   void (*reloc_dangerous)
    704          1.1  christos     (struct bfd_link_info *, const char *message,
    705          1.1  christos      bfd *abfd, asection *section, bfd_vma address);
    706          1.1  christos   /* A function which is called when a reloc is found to be attached
    707          1.1  christos      to a symbol which is not being written out.  NAME is the name of
    708          1.1  christos      the symbol.  ABFD, SECTION and ADDRESS identify the location of
    709          1.1  christos      the reloc; if this is the result of a
    710  1.1.1.4.2.1  pgoyette      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    711          1.1  christos      ABFD will be NULL.  */
    712          1.1  christos   void (*unattached_reloc)
    713          1.1  christos     (struct bfd_link_info *, const char *name,
    714      1.1.1.3  christos      bfd *abfd, asection *section, bfd_vma address);
    715      1.1.1.3  christos   /* A function which is called when a symbol in notice_hash is
    716      1.1.1.3  christos      defined or referenced.  H is the symbol, INH the indirect symbol
    717      1.1.1.3  christos      if applicable.  ABFD, SECTION and ADDRESS are the (new) value of
    718          1.1  christos      the symbol.  If SECTION is bfd_und_section, this is a reference.
    719      1.1.1.2  christos      FLAGS are the symbol BSF_* flags.  */
    720      1.1.1.3  christos   bfd_boolean (*notice)
    721      1.1.1.3  christos     (struct bfd_link_info *, struct bfd_link_hash_entry *h,
    722          1.1  christos      struct bfd_link_hash_entry *inh,
    723          1.1  christos      bfd *abfd, asection *section, bfd_vma address, flagword flags);
    724          1.1  christos   /* Error or warning link info message.  */
    725          1.1  christos   void (*einfo)
    726          1.1  christos     (const char *fmt, ...);
    727          1.1  christos   /* General link info message.  */
    728          1.1  christos   void (*info)
    729          1.1  christos     (const char *fmt, ...);
    730          1.1  christos   /* Message to be printed in linker map file.  */
    731          1.1  christos   void (*minfo)
    732          1.1  christos     (const char *fmt, ...);
    733          1.1  christos   /* This callback provides a chance for users of the BFD library to
    734          1.1  christos      override its decision about whether to place two adjacent sections
    735          1.1  christos      into the same segment.  */
    736          1.1  christos   bfd_boolean (*override_segment_assignment)
    737          1.1  christos     (struct bfd_link_info *, bfd * abfd,
    738          1.1  christos      asection * current_section, asection * previous_section,
    739          1.1  christos      bfd_boolean new_segment);
    740          1.1  christos };
    741          1.1  christos 
    742          1.1  christos /* The linker builds link_order structures which tell the code how to
    744          1.1  christos    include input data in the output file.  */
    745          1.1  christos 
    746          1.1  christos /* These are the types of link_order structures.  */
    747          1.1  christos 
    748          1.1  christos enum bfd_link_order_type
    749          1.1  christos {
    750          1.1  christos   bfd_undefined_link_order,	/* Undefined.  */
    751          1.1  christos   bfd_indirect_link_order,	/* Built from a section.  */
    752          1.1  christos   bfd_data_link_order,		/* Set to explicit data.  */
    753          1.1  christos   bfd_section_reloc_link_order,	/* Relocate against a section.  */
    754          1.1  christos   bfd_symbol_reloc_link_order	/* Relocate against a symbol.  */
    755          1.1  christos };
    756          1.1  christos 
    757          1.1  christos /* This is the link_order structure itself.  These form a chain
    758          1.1  christos    attached to the output section whose contents they are describing.  */
    759          1.1  christos 
    760          1.1  christos struct bfd_link_order
    761          1.1  christos {
    762          1.1  christos   /* Next link_order in chain.  */
    763          1.1  christos   struct bfd_link_order *next;
    764          1.1  christos   /* Type of link_order.  */
    765          1.1  christos   enum bfd_link_order_type type;
    766          1.1  christos   /* Offset within output section.  */
    767          1.1  christos   bfd_vma offset;
    768          1.1  christos   /* Size within output section.  */
    769          1.1  christos   bfd_size_type size;
    770          1.1  christos   /* Type specific information.  */
    771          1.1  christos   union
    772          1.1  christos     {
    773          1.1  christos       struct
    774          1.1  christos 	{
    775          1.1  christos 	  /* Section to include.  If this is used, then
    776          1.1  christos 	     section->output_section must be the section the
    777          1.1  christos 	     link_order is attached to, section->output_offset must
    778          1.1  christos 	     equal the link_order offset field, and section->size
    779          1.1  christos 	     must equal the link_order size field.  Maybe these
    780          1.1  christos 	     restrictions should be relaxed someday.  */
    781          1.1  christos 	  asection *section;
    782      1.1.1.2  christos 	} indirect;
    783      1.1.1.2  christos       struct
    784          1.1  christos 	{
    785          1.1  christos 	  /* Size of contents, or zero when contents should be filled by
    786          1.1  christos 	     the architecture-dependent fill function.
    787          1.1  christos 	     A non-zero value allows filling of the output section
    788          1.1  christos 	     with an arbitrary repeated pattern.  */
    789          1.1  christos 	  unsigned int size;
    790          1.1  christos 	  /* Data to put into file.  */
    791          1.1  christos 	  bfd_byte *contents;
    792          1.1  christos 	} data;
    793          1.1  christos       struct
    794          1.1  christos 	{
    795          1.1  christos 	  /* Description of reloc to generate.  Used for
    796          1.1  christos 	     bfd_section_reloc_link_order and
    797          1.1  christos 	     bfd_symbol_reloc_link_order.  */
    798          1.1  christos 	  struct bfd_link_order_reloc *p;
    799          1.1  christos 	} reloc;
    800          1.1  christos     } u;
    801          1.1  christos };
    802          1.1  christos 
    803          1.1  christos /* A linker order of type bfd_section_reloc_link_order or
    804          1.1  christos    bfd_symbol_reloc_link_order means to create a reloc against a
    805          1.1  christos    section or symbol, respectively.  This is used to implement -Ur to
    806          1.1  christos    generate relocs for the constructor tables.  The
    807          1.1  christos    bfd_link_order_reloc structure describes the reloc that BFD should
    808          1.1  christos    create.  It is similar to a arelent, but I didn't use arelent
    809          1.1  christos    because the linker does not know anything about most symbols, and
    810          1.1  christos    any asymbol structure it creates will be partially meaningless.
    811          1.1  christos    This information could logically be in the bfd_link_order struct,
    812          1.1  christos    but I didn't want to waste the space since these types of relocs
    813          1.1  christos    are relatively rare.  */
    814          1.1  christos 
    815          1.1  christos struct bfd_link_order_reloc
    816          1.1  christos {
    817          1.1  christos   /* Reloc type.  */
    818          1.1  christos   bfd_reloc_code_real_type reloc;
    819          1.1  christos 
    820          1.1  christos   union
    821          1.1  christos     {
    822          1.1  christos       /* For type bfd_section_reloc_link_order, this is the section
    823          1.1  christos 	 the reloc should be against.  This must be a section in the
    824          1.1  christos 	 output BFD, not any of the input BFDs.  */
    825          1.1  christos       asection *section;
    826          1.1  christos       /* For type bfd_symbol_reloc_link_order, this is the name of the
    827          1.1  christos 	 symbol the reloc should be against.  */
    828          1.1  christos       const char *name;
    829          1.1  christos     } u;
    830          1.1  christos 
    831          1.1  christos   /* Addend to use.  The object file should contain zero.  The BFD
    832          1.1  christos      backend is responsible for filling in the contents of the object
    833          1.1  christos      file correctly.  For some object file formats (e.g., COFF) the
    834          1.1  christos      addend must be stored into in the object file, and for some
    835          1.1  christos      (e.g., SPARC a.out) it is kept in the reloc.  */
    836          1.1  christos   bfd_vma addend;
    837          1.1  christos };
    838          1.1  christos 
    839          1.1  christos /* Allocate a new link_order for a section.  */
    840          1.1  christos extern struct bfd_link_order *bfd_new_link_order (bfd *, asection *);
    841          1.1  christos 
    842          1.1  christos /* These structures are used to describe version information for the
    843          1.1  christos    ELF linker.  These structures could be manipulated entirely inside
    844          1.1  christos    BFD, but it would be a pain.  Instead, the regular linker sets up
    845          1.1  christos    these structures, and then passes them into BFD.  */
    846          1.1  christos 
    847          1.1  christos /* Glob pattern for a version.  */
    848          1.1  christos 
    849          1.1  christos struct bfd_elf_version_expr
    850          1.1  christos {
    851          1.1  christos   /* Next glob pattern for this version.  */
    852          1.1  christos   struct bfd_elf_version_expr *next;
    853          1.1  christos   /* Glob pattern.  */
    854          1.1  christos   const char *pattern;
    855          1.1  christos   /* Set if pattern is not a glob.  */
    856          1.1  christos   unsigned int literal : 1;
    857          1.1  christos   /* Defined by ".symver".  */
    858          1.1  christos   unsigned int symver : 1;
    859          1.1  christos   /* Defined by version script.  */
    860          1.1  christos   unsigned int script : 1;
    861          1.1  christos   /* Pattern type.  */
    862          1.1  christos #define BFD_ELF_VERSION_C_TYPE		1
    863          1.1  christos #define BFD_ELF_VERSION_CXX_TYPE	2
    864          1.1  christos #define BFD_ELF_VERSION_JAVA_TYPE	4
    865          1.1  christos   unsigned int mask : 3;
    866          1.1  christos };
    867          1.1  christos 
    868          1.1  christos struct bfd_elf_version_expr_head
    869          1.1  christos {
    870          1.1  christos   /* List of all patterns, both wildcards and non-wildcards.  */
    871          1.1  christos   struct bfd_elf_version_expr *list;
    872          1.1  christos   /* Hash table for non-wildcards.  */
    873          1.1  christos   void *htab;
    874          1.1  christos   /* Remaining patterns.  */
    875          1.1  christos   struct bfd_elf_version_expr *remaining;
    876          1.1  christos   /* What kind of pattern types are present in list (bitmask).  */
    877          1.1  christos   unsigned int mask;
    878          1.1  christos };
    879          1.1  christos 
    880          1.1  christos /* Version dependencies.  */
    881          1.1  christos 
    882          1.1  christos struct bfd_elf_version_deps
    883          1.1  christos {
    884          1.1  christos   /* Next dependency for this version.  */
    885          1.1  christos   struct bfd_elf_version_deps *next;
    886          1.1  christos   /* The version which this version depends upon.  */
    887          1.1  christos   struct bfd_elf_version_tree *version_needed;
    888          1.1  christos };
    889          1.1  christos 
    890          1.1  christos /* A node in the version tree.  */
    891          1.1  christos 
    892          1.1  christos struct bfd_elf_version_tree
    893          1.1  christos {
    894          1.1  christos   /* Next version.  */
    895          1.1  christos   struct bfd_elf_version_tree *next;
    896          1.1  christos   /* Name of this version.  */
    897          1.1  christos   const char *name;
    898          1.1  christos   /* Version number.  */
    899          1.1  christos   unsigned int vernum;
    900          1.1  christos   /* Regular expressions for global symbols in this version.  */
    901          1.1  christos   struct bfd_elf_version_expr_head globals;
    902          1.1  christos   /* Regular expressions for local symbols in this version.  */
    903          1.1  christos   struct bfd_elf_version_expr_head locals;
    904          1.1  christos   /* List of versions which this version depends upon.  */
    905          1.1  christos   struct bfd_elf_version_deps *deps;
    906          1.1  christos   /* Index of the version name.  This is used within BFD.  */
    907          1.1  christos   unsigned int name_indx;
    908          1.1  christos   /* Whether this version tree was used.  This is used within BFD.  */
    909          1.1  christos   int used;
    910          1.1  christos   /* Matching hook.  */
    911          1.1  christos   struct bfd_elf_version_expr *(*match)
    912          1.1  christos     (struct bfd_elf_version_expr_head *head,
    913          1.1  christos      struct bfd_elf_version_expr *prev, const char *sym);
    914          1.1  christos };
    915          1.1  christos 
    916          1.1  christos struct bfd_elf_dynamic_list
    917          1.1  christos {
    918          1.1  christos   struct bfd_elf_version_expr_head head;
    919          1.1  christos   struct bfd_elf_version_expr *(*match)
    920          1.1  christos     (struct bfd_elf_version_expr_head *head,
    921          1.1  christos      struct bfd_elf_version_expr *prev, const char *sym);
    922                        };
    923                        
    924                        #endif
    925