Back to index

cell-binutils  2.17cvs20070401
bfdlink.h
Go to the documentation of this file.
00001 /* bfdlink.h -- header file for BFD link routines
00002    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
00003    2003, 2004, 2005 Free Software Foundation, Inc.
00004    Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
00005 
00006    This file is part of BFD, the Binary File Descriptor library.
00007 
00008    This program is free software; you can redistribute it and/or modify
00009    it under the terms of the GNU General Public License as published by
00010    the Free Software Foundation; either version 2 of the License, or
00011    (at your option) any later version.
00012 
00013    This program is distributed in the hope that it will be useful,
00014    but WITHOUT ANY WARRANTY; without even the implied warranty of
00015    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016    GNU General Public License for more details.
00017 
00018    You should have received a copy of the GNU General Public License
00019    along with this program; if not, write to the Free Software
00020    Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.  */
00021 
00022 #ifndef BFDLINK_H
00023 #define BFDLINK_H
00024 
00025 /* Which symbols to strip during a link.  */
00026 enum bfd_link_strip
00027 {
00028   strip_none,        /* Don't strip any symbols.  */
00029   strip_debugger,    /* Strip debugging symbols.  */
00030   strip_some,        /* keep_hash is the list of symbols to keep.  */
00031   strip_all          /* Strip all symbols.  */
00032 };
00033 
00034 /* Which local symbols to discard during a link.  This is irrelevant
00035    if strip_all is used.  */
00036 enum bfd_link_discard
00037 {
00038   discard_sec_merge, /* Discard local temporary symbols in SEC_MERGE
00039                         sections.  */
00040   discard_none,             /* Don't discard any locals.  */
00041   discard_l,         /* Discard local temporary symbols.  */
00042   discard_all        /* Discard all locals.  */
00043 };
00044 
00045 /* Describes the type of hash table entry structure being used.
00046    Different hash table structure have different fields and so
00047    support different linking features.  */
00048 enum bfd_link_hash_table_type
00049   {
00050     bfd_link_generic_hash_table,
00051     bfd_link_elf_hash_table
00052   };
00053 
00054 /* These are the possible types of an entry in the BFD link hash
00055    table.  */
00056 
00057 enum bfd_link_hash_type
00058 {
00059   bfd_link_hash_new,        /* Symbol is new.  */
00060   bfd_link_hash_undefined,  /* Symbol seen before, but undefined.  */
00061   bfd_link_hash_undefweak,  /* Symbol is weak and undefined.  */
00062   bfd_link_hash_defined,    /* Symbol is defined.  */
00063   bfd_link_hash_defweak,    /* Symbol is weak and defined.  */
00064   bfd_link_hash_common,            /* Symbol is common.  */
00065   bfd_link_hash_indirect,   /* Symbol is an indirect link.  */
00066   bfd_link_hash_warning            /* Like indirect, but warn if referenced.  */
00067 };
00068 
00069 enum bfd_link_common_skip_ar_aymbols
00070 {
00071   bfd_link_common_skip_none,
00072   bfd_link_common_skip_text,
00073   bfd_link_common_skip_data,
00074   bfd_link_common_skip_all
00075 };
00076 
00077 /* The linking routines use a hash table which uses this structure for
00078    its elements.  */
00079 
00080 struct bfd_link_hash_entry
00081 {
00082   /* Base hash table entry structure.  */
00083   struct bfd_hash_entry root;
00084 
00085   /* Type of this entry.  */
00086   enum bfd_link_hash_type type;
00087 
00088   /* A union of information depending upon the type.  */
00089   union
00090     {
00091       /* Nothing is kept for bfd_hash_new.  */
00092       /* bfd_link_hash_undefined, bfd_link_hash_undefweak.  */
00093       struct
00094        {
00095          /* Undefined and common symbols are kept in a linked list through
00096             this field.  This field is present in all of the union element
00097             so that we don't need to remove entries from the list when we
00098             change their type.  Removing entries would either require the
00099             list to be doubly linked, which would waste more memory, or
00100             require a traversal.  When an undefined or common symbol is
00101             created, it should be added to this list, the head of which is in
00102             the link hash table itself.  As symbols are defined, they need
00103             not be removed from the list; anything which reads the list must
00104             doublecheck the symbol type.
00105 
00106             Weak symbols are not kept on this list.
00107 
00108             Defined and defweak symbols use this field as a reference marker.
00109             If the field is not NULL, or this structure is the tail of the
00110             undefined symbol list, the symbol has been referenced.  If the
00111             symbol is undefined and becomes defined, this field will
00112             automatically be non-NULL since the symbol will have been on the
00113             undefined symbol list.  */
00114          struct bfd_link_hash_entry *next;
00115          bfd *abfd;         /* BFD symbol was found in.  */
00116          bfd *weak;         /* BFD weak symbol was found in.  */
00117        } undef;
00118       /* bfd_link_hash_defined, bfd_link_hash_defweak.  */
00119       struct
00120        {
00121          struct bfd_link_hash_entry *next;
00122          asection *section; /* Symbol section.  */
00123          bfd_vma value;     /* Symbol value.  */
00124        } def;
00125       /* bfd_link_hash_indirect, bfd_link_hash_warning.  */
00126       struct
00127        {
00128          struct bfd_link_hash_entry *next;
00129          struct bfd_link_hash_entry *link;       /* Real symbol.  */
00130          const char *warning;      /* Warning (bfd_link_hash_warning only).  */
00131        } i;
00132       /* bfd_link_hash_common.  */
00133       struct
00134        {
00135          struct bfd_link_hash_entry *next;
00136          /* The linker needs to know three things about common
00137             symbols: the size, the alignment, and the section in
00138             which the symbol should be placed.  We store the size
00139             here, and we allocate a small structure to hold the
00140             section and the alignment.  The alignment is stored as a
00141             power of two.  We don't store all the information
00142             directly because we don't want to increase the size of
00143             the union; this structure is a major space user in the
00144             linker.  */
00145          struct bfd_link_hash_common_entry
00146            {
00147              unsigned int alignment_power;       /* Alignment.  */
00148              asection *section;           /* Symbol section.  */
00149            } *p;
00150          bfd_size_type size;       /* Common symbol size.  */
00151        } c;
00152     } u;
00153 };
00154 
00155 /* This is the link hash table.  It is a derived class of
00156    bfd_hash_table.  */
00157 
00158 struct bfd_link_hash_table
00159 {
00160   /* The hash table itself.  */
00161   struct bfd_hash_table table;
00162   /* The back end which created this hash table.  This indicates the
00163      type of the entries in the hash table, which is sometimes
00164      important information when linking object files of different
00165      types together.  */
00166   const bfd_target *creator;
00167   /* A linked list of undefined and common symbols, linked through the
00168      next field in the bfd_link_hash_entry structure.  */
00169   struct bfd_link_hash_entry *undefs;
00170   /* Entries are added to the tail of the undefs list.  */
00171   struct bfd_link_hash_entry *undefs_tail;
00172   /* The type of the link hash table.  */
00173   enum bfd_link_hash_table_type type;
00174 };
00175 
00176 /* Look up an entry in a link hash table.  If FOLLOW is TRUE, this
00177    follows bfd_link_hash_indirect and bfd_link_hash_warning links to
00178    the real symbol.  */
00179 extern struct bfd_link_hash_entry *bfd_link_hash_lookup
00180   (struct bfd_link_hash_table *, const char *, bfd_boolean create,
00181    bfd_boolean copy, bfd_boolean follow);
00182 
00183 /* Look up an entry in the main linker hash table if the symbol might
00184    be wrapped.  This should only be used for references to an
00185    undefined symbol, not for definitions of a symbol.  */
00186 
00187 extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup
00188   (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
00189    bfd_boolean, bfd_boolean);
00190 
00191 /* Traverse a link hash table.  */
00192 extern void bfd_link_hash_traverse
00193   (struct bfd_link_hash_table *,
00194     bfd_boolean (*) (struct bfd_link_hash_entry *, void *),
00195     void *);
00196 
00197 /* Add an entry to the undefs list.  */
00198 extern void bfd_link_add_undef
00199   (struct bfd_link_hash_table *, struct bfd_link_hash_entry *);
00200 
00201 /* Remove symbols from the undefs list that don't belong there.  */
00202 extern void bfd_link_repair_undef_list
00203   (struct bfd_link_hash_table *table);
00204 
00205 struct bfd_sym_chain
00206 {
00207   struct bfd_sym_chain *next;
00208   const char *name;
00209 };
00210 
00211 /* How to handle unresolved symbols.
00212    There are four possibilities which are enumerated below:  */
00213 enum report_method
00214 {
00215   /* This is the initial value when then link_info structure is created.
00216      It allows the various stages of the linker to determine whether they
00217      allowed to set the value.  */
00218   RM_NOT_YET_SET = 0,
00219   RM_IGNORE,
00220   RM_GENERATE_WARNING,
00221   RM_GENERATE_ERROR
00222 };
00223 
00224 struct bfd_elf_dynamic_list;
00225 
00226 /* This structure holds all the information needed to communicate
00227    between BFD and the linker when doing a link.  */
00228 
00229 struct bfd_link_info
00230 {
00231   /* TRUE if BFD should generate a relocatable object file.  */
00232   unsigned int relocatable: 1;
00233 
00234   /* TRUE if BFD should generate relocation information in the final
00235      executable.  */
00236   unsigned int emitrelocations: 1;
00237 
00238   /* TRUE if BFD should generate a "task linked" object file,
00239      similar to relocatable but also with globals converted to
00240      statics.  */
00241   unsigned int task_link: 1;
00242 
00243   /* TRUE if BFD should generate a shared object.  */
00244   unsigned int shared: 1;
00245 
00246   /* TRUE if BFD should pre-bind symbols in a shared object.  */
00247   unsigned int symbolic: 1;
00248 
00249   /* TRUE if BFD should export all symbols in the dynamic symbol table
00250      of an executable, rather than only those used.  */
00251   unsigned int export_dynamic: 1;
00252 
00253   /* TRUE if shared objects should be linked directly, not shared.  */
00254   unsigned int static_link: 1;
00255 
00256   /* TRUE if the output file should be in a traditional format.  This
00257      is equivalent to the setting of the BFD_TRADITIONAL_FORMAT flag
00258      on the output file, but may be checked when reading the input
00259      files.  */
00260   unsigned int traditional_format: 1;
00261 
00262   /* TRUE if we want to produced optimized output files.  This might
00263      need much more time and therefore must be explicitly selected.  */
00264   unsigned int optimize: 1;
00265 
00266   /* TRUE if ok to have multiple definition.  */
00267   unsigned int allow_multiple_definition: 1;
00268 
00269   /* TRUE if ok to have version with no definition.  */
00270   unsigned int allow_undefined_version: 1;
00271 
00272   /* TRUE if a default symbol version should be created and used for
00273      exported symbols.  */
00274   unsigned int create_default_symver: 1;
00275 
00276   /* TRUE if a default symbol version should be created and used for
00277      imported symbols.  */
00278   unsigned int default_imported_symver: 1;
00279 
00280   /* TRUE if symbols should be retained in memory, FALSE if they
00281      should be freed and reread.  */
00282   unsigned int keep_memory: 1;
00283 
00284   /* TRUE if every symbol should be reported back via the notice
00285      callback.  */
00286   unsigned int notice_all: 1;
00287 
00288   /* TRUE if executable should not contain copy relocs.
00289      Setting this true may result in a non-sharable text segment.  */
00290   unsigned int nocopyreloc: 1;
00291 
00292   /* TRUE if the new ELF dynamic tags are enabled. */
00293   unsigned int new_dtags: 1;
00294 
00295   /* TRUE if non-PLT relocs should be merged into one reloc section
00296      and sorted so that relocs against the same symbol come together.  */
00297   unsigned int combreloc: 1;
00298 
00299   /* TRUE if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
00300      should be created.  */
00301   unsigned int eh_frame_hdr: 1;
00302 
00303   /* TRUE if global symbols in discarded sections should be stripped.  */
00304   unsigned int strip_discarded: 1;
00305 
00306   /* TRUE if generating a position independent executable.  */
00307   unsigned int pie: 1;
00308 
00309   /* TRUE if generating an executable, position independent or not.  */
00310   unsigned int executable : 1;
00311 
00312   /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W|PF_X
00313      flags.  */
00314   unsigned int execstack: 1;
00315 
00316   /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W
00317      flags.  */
00318   unsigned int noexecstack: 1;
00319 
00320   /* TRUE if PT_GNU_RELRO segment should be created.  */
00321   unsigned int relro: 1;
00322 
00323   /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
00324   unsigned int warn_shared_textrel: 1;
00325 
00326   /* TRUE if unreferenced sections should be removed.  */
00327   unsigned int gc_sections: 1;
00328 
00329   /* TRUE if user shoudl be informed of removed unreferenced sections.  */
00330   unsigned int print_gc_sections: 1;
00331 
00332   /* TRUE if .hash section should be created.  */
00333   unsigned int emit_hash: 1;
00334 
00335   /* TRUE if .gnu.hash section should be created.  */
00336   unsigned int emit_gnu_hash: 1;
00337 
00338   /* If TRUE reduce memory overheads, at the expense of speed. This will
00339      cause map file generation to use an O(N^2) algorithm and disable
00340      caching ELF symbol buffer.  */
00341   unsigned int reduce_memory_overheads: 1;
00342 
00343   /* TRUE if all data symbols should be dynamic.  */
00344    unsigned int dynamic_data: 1;
00345 
00346   /* TRUE if some symbols have to be dynamic, controlled by
00347      --dynamic-list command line options.  */
00348   unsigned int dynamic: 1;
00349 
00350   /* What to do with unresolved symbols in an object file.
00351      When producing executables the default is GENERATE_ERROR.
00352      When producing shared libraries the default is IGNORE.  The
00353      assumption with shared libraries is that the reference will be
00354      resolved at load/execution time.  */
00355   enum report_method unresolved_syms_in_objects;
00356 
00357   /* What to do with unresolved symbols in a shared library.
00358      The same defaults apply.  */
00359   enum report_method unresolved_syms_in_shared_libs;
00360 
00361   /* Which symbols to strip.  */
00362   enum bfd_link_strip strip;
00363 
00364   /* Which local symbols to discard.  */
00365   enum bfd_link_discard discard;
00366 
00367   /* Criteria for skipping symbols when detemining
00368      whether to include an object from an archive. */
00369   enum bfd_link_common_skip_ar_aymbols common_skip_ar_aymbols;
00370 
00371   /* Char that may appear as the first char of a symbol, but should be
00372      skipped (like symbol_leading_char) when looking up symbols in
00373      wrap_hash.  Used by PowerPC Linux for 'dot' symbols.  */
00374   char wrap_char;
00375 
00376   /* Function callbacks.  */
00377   const struct bfd_link_callbacks *callbacks;
00378 
00379   /* Hash table handled by BFD.  */
00380   struct bfd_link_hash_table *hash;
00381 
00382   /* Hash table of symbols to keep.  This is NULL unless strip is
00383      strip_some.  */
00384   struct bfd_hash_table *keep_hash;
00385 
00386   /* Hash table of symbols to report back via the notice callback.  If
00387      this is NULL, and notice_all is FALSE, then no symbols are
00388      reported back.  */
00389   struct bfd_hash_table *notice_hash;
00390 
00391   /* Hash table of symbols which are being wrapped (the --wrap linker
00392      option).  If this is NULL, no symbols are being wrapped.  */
00393   struct bfd_hash_table *wrap_hash;
00394 
00395   /* The list of input BFD's involved in the link.  These are chained
00396      together via the link_next field.  */
00397   bfd *input_bfds;
00398 
00399   /* If a symbol should be created for each input BFD, this is section
00400      where those symbols should be placed.  It must be a section in
00401      the output BFD.  It may be NULL, in which case no such symbols
00402      will be created.  This is to support CREATE_OBJECT_SYMBOLS in the
00403      linker command language.  */
00404   asection *create_object_symbols_section;
00405 
00406   /* List of global symbol names that are starting points for marking
00407      sections against garbage collection.  */
00408   struct bfd_sym_chain *gc_sym_list;
00409 
00410   /* If a base output file is wanted, then this points to it */
00411   void *base_file;
00412 
00413   /* The function to call when the executable or shared object is
00414      loaded.  */
00415   const char *init_function;
00416 
00417   /* The function to call when the executable or shared object is
00418      unloaded.  */
00419   const char *fini_function;
00420 
00421   /* Number of relaxation passes.  Usually only one relaxation pass
00422      is needed.  But a backend can have as many relaxation passes as
00423      necessary.  During bfd_relax_section call, it is set to the
00424      current pass, starting from 0.  */
00425   int relax_pass;
00426 
00427   /* Non-zero if auto-import thunks for DATA items in pei386 DLLs
00428      should be generated/linked against.  Set to 1 if this feature
00429      is explicitly requested by the user, -1 if enabled by default.  */
00430   int pei386_auto_import;
00431 
00432   /* Non-zero if runtime relocs for DATA items with non-zero addends
00433      in pei386 DLLs should be generated.  Set to 1 if this feature
00434      is explicitly requested by the user, -1 if enabled by default.  */
00435   int pei386_runtime_pseudo_reloc;
00436 
00437   /* How many spare .dynamic DT_NULL entries should be added?  */
00438   unsigned int spare_dynamic_tags;
00439 
00440   /* May be used to set DT_FLAGS for ELF. */
00441   bfd_vma flags;
00442 
00443   /* May be used to set DT_FLAGS_1 for ELF. */
00444   bfd_vma flags_1;
00445 
00446   /* Start and end of RELRO region.  */
00447   bfd_vma relro_start, relro_end;
00448 
00449   /* List of symbols should be dynamic.  */
00450   struct bfd_elf_dynamic_list *dynamic_list;
00451 };
00452 
00453 /* This structures holds a set of callback functions.  These are
00454    called by the BFD linker routines.  Except for einfo, the first
00455    argument to each callback function is the bfd_link_info structure
00456    being used and each function returns a boolean value.  If the
00457    function returns FALSE, then the BFD function which called it should
00458    return with a failure indication.  */
00459 
00460 struct bfd_link_callbacks
00461 {
00462   /* A function which is called when an object is added from an
00463      archive.  ABFD is the archive element being added.  NAME is the
00464      name of the symbol which caused the archive element to be pulled
00465      in.  */
00466   bfd_boolean (*add_archive_element)
00467     (struct bfd_link_info *, bfd *abfd, const char *name);
00468   /* A function which is called when a symbol is found with multiple
00469      definitions.  NAME is the symbol which is defined multiple times.
00470      OBFD is the old BFD, OSEC is the old section, OVAL is the old
00471      value, NBFD is the new BFD, NSEC is the new section, and NVAL is
00472      the new value.  OBFD may be NULL.  OSEC and NSEC may be
00473      bfd_com_section or bfd_ind_section.  */
00474   bfd_boolean (*multiple_definition)
00475     (struct bfd_link_info *, const char *name,
00476      bfd *obfd, asection *osec, bfd_vma oval,
00477      bfd *nbfd, asection *nsec, bfd_vma nval);
00478   /* A function which is called when a common symbol is defined
00479      multiple times.  NAME is the symbol appearing multiple times.
00480      OBFD is the BFD of the existing symbol; it may be NULL if this is
00481      not known.  OTYPE is the type of the existing symbol, which may
00482      be bfd_link_hash_defined, bfd_link_hash_defweak,
00483      bfd_link_hash_common, or bfd_link_hash_indirect.  If OTYPE is
00484      bfd_link_hash_common, OSIZE is the size of the existing symbol.
00485      NBFD is the BFD of the new symbol.  NTYPE is the type of the new
00486      symbol, one of bfd_link_hash_defined, bfd_link_hash_common, or
00487      bfd_link_hash_indirect.  If NTYPE is bfd_link_hash_common, NSIZE
00488      is the size of the new symbol.  */
00489   bfd_boolean (*multiple_common)
00490     (struct bfd_link_info *, const char *name,
00491      bfd *obfd, enum bfd_link_hash_type otype, bfd_vma osize,
00492      bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize);
00493   /* A function which is called to add a symbol to a set.  ENTRY is
00494      the link hash table entry for the set itself (e.g.,
00495      __CTOR_LIST__).  RELOC is the relocation to use for an entry in
00496      the set when generating a relocatable file, and is also used to
00497      get the size of the entry when generating an executable file.
00498      ABFD, SEC and VALUE identify the value to add to the set.  */
00499   bfd_boolean (*add_to_set)
00500     (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
00501      bfd_reloc_code_real_type reloc, bfd *abfd, asection *sec, bfd_vma value);
00502   /* A function which is called when the name of a g++ constructor or
00503      destructor is found.  This is only called by some object file
00504      formats.  CONSTRUCTOR is TRUE for a constructor, FALSE for a
00505      destructor.  This will use BFD_RELOC_CTOR when generating a
00506      relocatable file.  NAME is the name of the symbol found.  ABFD,
00507      SECTION and VALUE are the value of the symbol.  */
00508   bfd_boolean (*constructor)
00509     (struct bfd_link_info *, bfd_boolean constructor, const char *name,
00510      bfd *abfd, asection *sec, bfd_vma value);
00511   /* A function which is called to issue a linker warning.  For
00512      example, this is called when there is a reference to a warning
00513      symbol.  WARNING is the warning to be issued.  SYMBOL is the name
00514      of the symbol which triggered the warning; it may be NULL if
00515      there is none.  ABFD, SECTION and ADDRESS identify the location
00516      which trigerred the warning; either ABFD or SECTION or both may
00517      be NULL if the location is not known.  */
00518   bfd_boolean (*warning)
00519     (struct bfd_link_info *, const char *warning, const char *symbol,
00520      bfd *abfd, asection *section, bfd_vma address);
00521   /* A function which is called when a relocation is attempted against
00522      an undefined symbol.  NAME is the symbol which is undefined.
00523      ABFD, SECTION and ADDRESS identify the location from which the
00524      reference is made. FATAL indicates whether an undefined symbol is
00525      a fatal error or not. In some cases SECTION may be NULL.  */
00526   bfd_boolean (*undefined_symbol)
00527     (struct bfd_link_info *, const char *name, bfd *abfd,
00528      asection *section, bfd_vma address, bfd_boolean fatal);
00529   /* A function which is called when a reloc overflow occurs. ENTRY is
00530      the link hash table entry for the symbol the reloc is against.
00531      NAME is the name of the local symbol or section the reloc is
00532      against, RELOC_NAME is the name of the relocation, and ADDEND is
00533      any addend that is used.  ABFD, SECTION and ADDRESS identify the
00534      location at which the overflow occurs; if this is the result of a
00535      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
00536      ABFD will be NULL.  */
00537   bfd_boolean (*reloc_overflow)
00538     (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
00539      const char *name, const char *reloc_name, bfd_vma addend,
00540      bfd *abfd, asection *section, bfd_vma address);
00541   /* A function which is called when a dangerous reloc is performed.
00542      MESSAGE is an appropriate message.
00543      ABFD, SECTION and ADDRESS identify the location at which the
00544      problem occurred; if this is the result of a
00545      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
00546      ABFD will be NULL.  */
00547   bfd_boolean (*reloc_dangerous)
00548     (struct bfd_link_info *, const char *message,
00549      bfd *abfd, asection *section, bfd_vma address);
00550   /* A function which is called when a reloc is found to be attached
00551      to a symbol which is not being written out.  NAME is the name of
00552      the symbol.  ABFD, SECTION and ADDRESS identify the location of
00553      the reloc; if this is the result of a
00554      bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
00555      ABFD will be NULL.  */
00556   bfd_boolean (*unattached_reloc)
00557     (struct bfd_link_info *, const char *name,
00558      bfd *abfd, asection *section, bfd_vma address);
00559   /* A function which is called when a symbol in notice_hash is
00560      defined or referenced.  NAME is the symbol.  ABFD, SECTION and
00561      ADDRESS are the value of the symbol.  If SECTION is
00562      bfd_und_section, this is a reference.  */
00563   bfd_boolean (*notice)
00564     (struct bfd_link_info *, const char *name,
00565      bfd *abfd, asection *section, bfd_vma address);
00566   /* General link info message.  */
00567   void (*einfo)
00568     (const char *fmt, ...);
00569   /* This callback provides a chance for users of the BFD library to
00570      override its decision about whether to place two adjacent sections
00571      into the same segment.  */
00572   bfd_boolean (*override_segment_assignment)
00573     (struct bfd_link_info *, bfd * abfd,
00574      asection * current_section, asection * previous_section,
00575      bfd_boolean new_segment);
00576 };
00577 
00578 /* The linker builds link_order structures which tell the code how to
00579    include input data in the output file.  */
00580 
00581 /* These are the types of link_order structures.  */
00582 
00583 enum bfd_link_order_type
00584 {
00585   bfd_undefined_link_order, /* Undefined.  */
00586   bfd_indirect_link_order,  /* Built from a section.  */
00587   bfd_data_link_order,             /* Set to explicit data.  */
00588   bfd_section_reloc_link_order,    /* Relocate against a section.  */
00589   bfd_symbol_reloc_link_order      /* Relocate against a symbol.  */
00590 };
00591 
00592 /* This is the link_order structure itself.  These form a chain
00593    attached to the output section whose contents they are describing.  */
00594 
00595 struct bfd_link_order
00596 {
00597   /* Next link_order in chain.  */
00598   struct bfd_link_order *next;
00599   /* Type of link_order.  */
00600   enum bfd_link_order_type type;
00601   /* Offset within output section.  */
00602   bfd_vma offset;
00603   /* Size within output section.  */
00604   bfd_size_type size;
00605   /* Type specific information.  */
00606   union
00607     {
00608       struct
00609        {
00610          /* Section to include.  If this is used, then
00611             section->output_section must be the section the
00612             link_order is attached to, section->output_offset must
00613             equal the link_order offset field, and section->size
00614             must equal the link_order size field.  Maybe these
00615             restrictions should be relaxed someday.  */
00616          asection *section;
00617        } indirect;
00618       struct
00619        {
00620          /* Size of contents, or zero when contents size == size
00621             within output section.
00622             A non-zero value allows filling of the output section
00623             with an arbitrary repeated pattern.  */
00624          unsigned int size;
00625          /* Data to put into file.  */
00626          bfd_byte *contents;
00627        } data;
00628       struct
00629        {
00630          /* Description of reloc to generate.  Used for
00631             bfd_section_reloc_link_order and
00632             bfd_symbol_reloc_link_order.  */
00633          struct bfd_link_order_reloc *p;
00634        } reloc;
00635     } u;
00636 };
00637 
00638 /* A linker order of type bfd_section_reloc_link_order or
00639    bfd_symbol_reloc_link_order means to create a reloc against a
00640    section or symbol, respectively.  This is used to implement -Ur to
00641    generate relocs for the constructor tables.  The
00642    bfd_link_order_reloc structure describes the reloc that BFD should
00643    create.  It is similar to a arelent, but I didn't use arelent
00644    because the linker does not know anything about most symbols, and
00645    any asymbol structure it creates will be partially meaningless.
00646    This information could logically be in the bfd_link_order struct,
00647    but I didn't want to waste the space since these types of relocs
00648    are relatively rare.  */
00649 
00650 struct bfd_link_order_reloc
00651 {
00652   /* Reloc type.  */
00653   bfd_reloc_code_real_type reloc;
00654 
00655   union
00656     {
00657       /* For type bfd_section_reloc_link_order, this is the section
00658         the reloc should be against.  This must be a section in the
00659         output BFD, not any of the input BFDs.  */
00660       asection *section;
00661       /* For type bfd_symbol_reloc_link_order, this is the name of the
00662         symbol the reloc should be against.  */
00663       const char *name;
00664     } u;
00665 
00666   /* Addend to use.  The object file should contain zero.  The BFD
00667      backend is responsible for filling in the contents of the object
00668      file correctly.  For some object file formats (e.g., COFF) the
00669      addend must be stored into in the object file, and for some
00670      (e.g., SPARC a.out) it is kept in the reloc.  */
00671   bfd_vma addend;
00672 };
00673 
00674 /* Allocate a new link_order for a section.  */
00675 extern struct bfd_link_order *bfd_new_link_order (bfd *, asection *);
00676 
00677 /* These structures are used to describe version information for the
00678    ELF linker.  These structures could be manipulated entirely inside
00679    BFD, but it would be a pain.  Instead, the regular linker sets up
00680    these structures, and then passes them into BFD.  */
00681 
00682 /* Glob pattern for a version.  */
00683 
00684 struct bfd_elf_version_expr
00685 {
00686   /* Next glob pattern for this version.  */
00687   struct bfd_elf_version_expr *next;
00688   /* Glob pattern.  */
00689   const char *pattern;
00690   /* NULL for a glob pattern, otherwise a straight symbol.  */
00691   const char *symbol;
00692   /* Defined by ".symver".  */
00693   unsigned int symver : 1;
00694   /* Defined by version script.  */
00695   unsigned int script : 1;
00696   /* Pattern type.  */
00697 #define BFD_ELF_VERSION_C_TYPE            1
00698 #define BFD_ELF_VERSION_CXX_TYPE   2
00699 #define BFD_ELF_VERSION_JAVA_TYPE  4
00700   unsigned int mask : 3;
00701 };
00702 
00703 struct bfd_elf_version_expr_head
00704 {
00705   /* List of all patterns, both wildcards and non-wildcards.  */
00706   struct bfd_elf_version_expr *list;
00707   /* Hash table for non-wildcards.  */
00708   void *htab;
00709   /* Remaining patterns.  */
00710   struct bfd_elf_version_expr *remaining;
00711   /* What kind of pattern types are present in list (bitmask).  */
00712   unsigned int mask;
00713 };
00714 
00715 /* Version dependencies.  */
00716 
00717 struct bfd_elf_version_deps
00718 {
00719   /* Next dependency for this version.  */
00720   struct bfd_elf_version_deps *next;
00721   /* The version which this version depends upon.  */
00722   struct bfd_elf_version_tree *version_needed;
00723 };
00724 
00725 /* A node in the version tree.  */
00726 
00727 struct bfd_elf_version_tree
00728 {
00729   /* Next version.  */
00730   struct bfd_elf_version_tree *next;
00731   /* Name of this version.  */
00732   const char *name;
00733   /* Version number.  */
00734   unsigned int vernum;
00735   /* Regular expressions for global symbols in this version.  */
00736   struct bfd_elf_version_expr_head globals;
00737   /* Regular expressions for local symbols in this version.  */
00738   struct bfd_elf_version_expr_head locals;
00739   /* List of versions which this version depends upon.  */
00740   struct bfd_elf_version_deps *deps;
00741   /* Index of the version name.  This is used within BFD.  */
00742   unsigned int name_indx;
00743   /* Whether this version tree was used.  This is used within BFD.  */
00744   int used;
00745   /* Matching hook.  */
00746   struct bfd_elf_version_expr *(*match)
00747     (struct bfd_elf_version_expr_head *head,
00748      struct bfd_elf_version_expr *prev, const char *sym);
00749 };
00750 
00751 struct bfd_elf_dynamic_list
00752 {
00753   struct bfd_elf_version_expr_head head;
00754   struct bfd_elf_version_expr *(*match)
00755     (struct bfd_elf_version_expr_head *head,
00756      struct bfd_elf_version_expr *prev, const char *sym);
00757 };
00758 
00759 #endif