Ignore:
Timestamp:
Aug 16, 2003, 6:59:22 PM (22 years ago)
Author:
bird
Message:

binutils v2.14 - offical sources.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GNU/src/binutils/include/bfdlink.h

    • Property cvs2svn:cvs-rev changed from 1.1 to 1.1.1.2
    r608 r609  
    11/* bfdlink.h -- header file for BFD link routines
    2    Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000
     2   Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2002
    33   Free Software Foundation, Inc.
    44   Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
    55
    6 This file is part of BFD, the Binary File Descriptor library.
    7 
    8 This program is free software; you can redistribute it and/or modify
    9 it under the terms of the GNU General Public License as published by
    10 the Free Software Foundation; either version 2 of the License, or
    11 (at your option) any later version.
    12 
    13 This program is distributed in the hope that it will be useful,
    14 but WITHOUT ANY WARRANTY; without even the implied warranty of
    15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    16 GNU General Public License for more details.
    17 
    18 You should have received a copy of the GNU General Public License
    19 along with this program; if not, write to the Free Software
    20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
     6   This file is part of BFD, the Binary File Descriptor library.
     7
     8   This program is free software; you can redistribute it and/or modify
     9   it under the terms of the GNU General Public License as published by
     10   the Free Software Foundation; either version 2 of the License, or
     11   (at your option) any later version.
     12
     13   This program is distributed in the hope that it will be useful,
     14   but WITHOUT ANY WARRANTY; without even the implied warranty of
     15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     16   GNU General Public License for more details.
     17
     18   You should have received a copy of the GNU General Public License
     19   along with this program; if not, write to the Free Software
     20   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
    2121
    2222#ifndef BFDLINK_H
     
    3636enum bfd_link_discard
    3737{
     38  discard_sec_merge,    /* Discard local temporary symbols in SEC_MERGE
     39                           sections.  */
    3840  discard_none,         /* Don't discard any locals.  */
    3941  discard_l,            /* Discard local temporary symbols.  */
    4042  discard_all           /* Discard all locals.  */
    4143};
     44
     45/* Describes the type of hash table entry structure being used.
     46   Different hash table structure have different fields and so
     47   support different linking features.  */
     48enum bfd_link_hash_table_type
     49  {
     50    bfd_link_generic_hash_table,
     51    bfd_link_elf_hash_table
     52  };
    4253
    4354
     
    5566  bfd_link_hash_indirect,       /* Symbol is an indirect link.  */
    5667  bfd_link_hash_warning         /* Like indirect, but warn if referenced.  */
     68};
     69
     70enum bfd_link_common_skip_ar_aymbols
     71{
     72  bfd_link_common_skip_none,
     73  bfd_link_common_skip_text,
     74  bfd_link_common_skip_data,
     75  bfd_link_common_skip_all
    5776};
    5877
     
    111130        {
    112131          /* The linker needs to know three things about common
    113              symbols: the size, the alignment, and the section in
    114              which the symbol should be placed.  We store the size
    115              here, and we allocate a small structure to hold the
    116              section and the alignment.  The alignment is stored as a
    117              power of two.  We don't store all the information
    118              directly because we don't want to increase the size of
    119              the union; this structure is a major space user in the
    120              linker.  */
     132             symbols: the size, the alignment, and the section in
     133             which the symbol should be placed.  We store the size
     134             here, and we allocate a small structure to hold the
     135             section and the alignment.  The alignment is stored as a
     136             power of two.  We don't store all the information
     137             directly because we don't want to increase the size of
     138             the union; this structure is a major space user in the
     139             linker.  */
    121140          bfd_size_type size;   /* Common symbol size.  */
    122141          struct bfd_link_hash_common_entry
     
    146165  /* Entries are added to the tail of the undefs list.  */
    147166  struct bfd_link_hash_entry *undefs_tail;
    148 };
    149 
    150 /* Look up an entry in a link hash table.  If FOLLOW is true, this
     167  /* The type of the link hash table.  */
     168  enum bfd_link_hash_table_type type;
     169};
     170
     171/* Look up an entry in a link hash table.  If FOLLOW is TRUE, this
    151172   follows bfd_link_hash_indirect and bfd_link_hash_warning links to
    152173   the real symbol.  */
    153174extern struct bfd_link_hash_entry *bfd_link_hash_lookup
    154   PARAMS ((struct bfd_link_hash_table *, const char *, boolean create,
    155            boolean copy, boolean follow));
     175  PARAMS ((struct bfd_link_hash_table *, const char *, bfd_boolean create,
     176           bfd_boolean copy, bfd_boolean follow));
    156177
    157178/* Look up an entry in the main linker hash table if the symbol might
     
    160181
    161182extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup
    162   PARAMS ((bfd *, struct bfd_link_info *, const char *, boolean, boolean,
    163            boolean));
     183  PARAMS ((bfd *, struct bfd_link_info *, const char *, bfd_boolean,
     184           bfd_boolean, bfd_boolean));
    164185
    165186/* Traverse a link hash table.  */
    166187extern void bfd_link_hash_traverse
    167188  PARAMS ((struct bfd_link_hash_table *,
    168            boolean (*) (struct bfd_link_hash_entry *, PTR),
     189           bfd_boolean (*) (struct bfd_link_hash_entry *, PTR),
    169190           PTR));
    170191
     
    173194  PARAMS ((struct bfd_link_hash_table *, struct bfd_link_hash_entry *));
    174195
     196struct bfd_sym_chain
     197{
     198  struct bfd_sym_chain *next;
     199  const char *name;
     200};
     201
    175202
    176203/* This structure holds all the information needed to communicate
     
    179206struct bfd_link_info
    180207{
    181   /* Function callbacks.  */
    182   const struct bfd_link_callbacks *callbacks;
    183   /* true if BFD should generate a relocateable object file.  */
    184   boolean relocateable;
    185   /* true if BFD should generate relocation information in the final executable.  */
    186   boolean emitrelocations;
    187   /* true if BFD should generate a "task linked" object file,
    188      similar to relocatable but also with globals converted to statics. */
    189   boolean task_link;
    190   /* true if BFD should generate a shared object.  */
    191   boolean shared;
    192   /* true if BFD should pre-bind symbols in a shared object.  */
    193   boolean symbolic;
    194   /* true if shared objects should be linked directly, not shared.  */
    195   boolean static_link;
    196   /* true if the output file should be in a traditional format.  This
     208  /* TRUE if BFD should generate a relocatable object file.  */
     209  unsigned int relocateable: 1;
     210
     211  /* TRUE if BFD should generate relocation information in the final
     212     executable.  */
     213  unsigned int emitrelocations: 1;
     214
     215  /* TRUE if BFD should generate a "task linked" object file,
     216     similar to relocatable but also with globals converted to
     217     statics.  */
     218  unsigned int task_link: 1;
     219
     220  /* TRUE if BFD should generate a shared object.  */
     221  unsigned int shared: 1;
     222
     223  /* TRUE if BFD should pre-bind symbols in a shared object.  */
     224  unsigned int symbolic: 1;
     225
     226  /* TRUE if BFD should export all symbols in the dynamic symbol table
     227     of an executable, rather than only those used.  */
     228  unsigned int export_dynamic: 1;
     229
     230  /* TRUE if shared objects should be linked directly, not shared.  */
     231  unsigned int static_link: 1;
     232
     233  /* TRUE if the output file should be in a traditional format.  This
    197234     is equivalent to the setting of the BFD_TRADITIONAL_FORMAT flag
    198235     on the output file, but may be checked when reading the input
    199236     files.  */
    200   boolean traditional_format;
    201   /* true if we want to produced optimized output files.  This might
     237  unsigned int traditional_format: 1;
     238
     239  /* TRUE if we want to produced optimized output files.  This might
    202240     need much more time and therefore must be explicitly selected.  */
    203   boolean optimize;
    204   /* true if BFD should generate errors for undefined symbols
     241  unsigned int optimize: 1;
     242
     243  /* TRUE if BFD should generate errors for undefined symbols
    205244     even if generating a shared object.  */
    206   boolean no_undefined;
    207   /* true if BFD should allow undefined symbols in shared objects even
     245  unsigned int no_undefined: 1;
     246
     247  /* TRUE if BFD should allow undefined symbols in shared objects even
    208248     when no_undefined is set to disallow undefined symbols.  The net
    209249     result will be that undefined symbols in regular objects will
     
    217257     select an appropriate memset function.  Apparently it is also
    218258     normal for HPPA shared libraries to have undefined symbols.  */
    219   boolean allow_shlib_undefined;
     259  unsigned int allow_shlib_undefined: 1;
     260
     261  /* TRUE if ok to have multiple definition.  */
     262  unsigned int allow_multiple_definition: 1;
     263
     264  /* TRUE if ok to have version with no definition.  */
     265  unsigned int allow_undefined_version: 1;
     266
     267  /* TRUE if symbols should be retained in memory, FALSE if they
     268     should be freed and reread.  */
     269  unsigned int keep_memory: 1;
     270
     271  /* TRUE if every symbol should be reported back via the notice
     272     callback.  */
     273  unsigned int notice_all: 1;
     274
     275  /* TRUE if executable should not contain copy relocs.
     276     Setting this true may result in a non-sharable text segment.  */
     277  unsigned int nocopyreloc: 1;
     278
     279  /* TRUE if the new ELF dynamic tags are enabled. */
     280  unsigned int new_dtags: 1;
     281
     282  /* TRUE if non-PLT relocs should be merged into one reloc section
     283     and sorted so that relocs against the same symbol come together.  */
     284  unsigned int combreloc: 1;
     285
     286  /* TRUE if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
     287     should be created.  */
     288  unsigned int eh_frame_hdr: 1;
     289
     290  /* TRUE if global symbols in discarded sections should be stripped.  */
     291  unsigned int strip_discarded: 1;
     292
     293  /* TRUE if relaxation is being finalized.  */
     294  unsigned int relax_finalizing: 1;
     295
    220296  /* Which symbols to strip.  */
    221297  enum bfd_link_strip strip;
     298
    222299  /* Which local symbols to discard.  */
    223300  enum bfd_link_discard discard;
    224   /* true if symbols should be retained in memory, false if they
    225      should be freed and reread.  */
    226   boolean keep_memory;
     301
     302  /* Criteria for skipping symbols when detemining
     303     whether to include an object from an archive. */
     304  enum bfd_link_common_skip_ar_aymbols common_skip_ar_aymbols;
     305
     306  /* Function callbacks.  */
     307  const struct bfd_link_callbacks *callbacks;
     308
     309  /* Hash table handled by BFD.  */
     310  struct bfd_link_hash_table *hash;
     311
     312  /* Hash table of symbols to keep.  This is NULL unless strip is
     313     strip_some.  */
     314  struct bfd_hash_table *keep_hash;
     315
     316  /* Hash table of symbols to report back via the notice callback.  If
     317     this is NULL, and notice_all is FALSE, then no symbols are
     318     reported back.  */
     319  struct bfd_hash_table *notice_hash;
     320
     321  /* Hash table of symbols which are being wrapped (the --wrap linker
     322     option).  If this is NULL, no symbols are being wrapped.  */
     323  struct bfd_hash_table *wrap_hash;
     324
    227325  /* The list of input BFD's involved in the link.  These are chained
    228326     together via the link_next field.  */
    229327  bfd *input_bfds;
     328
    230329  /* If a symbol should be created for each input BFD, this is section
    231330     where those symbols should be placed.  It must be a section in
     
    234333     linker command language.  */
    235334  asection *create_object_symbols_section;
    236   /* Hash table handled by BFD.  */
    237   struct bfd_link_hash_table *hash;
    238   /* Hash table of symbols to keep.  This is NULL unless strip is
    239      strip_some.  */
    240   struct bfd_hash_table *keep_hash;
    241   /* true if every symbol should be reported back via the notice
    242      callback.  */
    243   boolean notice_all;
    244   /* Hash table of symbols to report back via the notice callback.  If
    245      this is NULL, and notice_all is false, then no symbols are
    246      reported back.  */
    247   struct bfd_hash_table *notice_hash;
    248   /* Hash table of symbols which are being wrapped (the --wrap linker
    249      option).  If this is NULL, no symbols are being wrapped.  */
    250   struct bfd_hash_table *wrap_hash;
     335
     336  /* List of global symbol names that are starting points for marking
     337     sections against garbage collection.  */
     338  struct bfd_sym_chain *gc_sym_list;
     339
    251340  /* If a base output file is wanted, then this points to it */
    252341  PTR base_file;
    253 
    254   /* If non-zero, specifies that branches which are problematic for the
    255   MPC860 C0 (or earlier) should be checked for and modified.  It gives the
    256   number of bytes that should be checked at the end of each text page. */
    257   int mpc860c0;
    258342
    259343  /* The function to call when the executable or shared object is
    260344     loaded.  */
    261345  const char *init_function;
     346
    262347  /* The function to call when the executable or shared object is
    263348     unloaded.  */
    264349  const char *fini_function;
    265350
    266   /* true if the new ELF dynamic tags are enabled. */
    267   boolean new_dtags;
     351  /* If non-zero, specifies that branches which are problematic for the
     352     MPC860 C0 (or earlier) should be checked for and modified.  It gives the
     353     number of bytes that should be checked at the end of each text page.  */
     354  int mpc860c0;
     355
     356  /* Non-zero if auto-import thunks for DATA items in pei386 DLLs
     357     should be generated/linked against.  Set to 1 if this feature
     358     is explicitly requested by the user, -1 if enabled by default.  */
     359  int pei386_auto_import;
     360
     361  /* Non-zero if runtime relocs for DATA items with non-zero addends
     362     in pei386 DLLs should be generated.  Set to 1 if this feature
     363     is explicitly requested by the user, -1 if enabled by default.  */
     364  int pei386_runtime_pseudo_reloc;
     365
     366  /* How many spare .dynamic DT_NULL entries should be added?  */
     367  unsigned int spare_dynamic_tags;
    268368
    269369  /* May be used to set DT_FLAGS for ELF. */
     
    277377   called by the BFD linker routines.  The first argument to each
    278378   callback function is the bfd_link_info structure being used.  Each
    279    function returns a boolean value.  If the function returns false,
     379   function returns a boolean value.  If the function returns FALSE,
    280380   then the BFD function which called it will return with a failure
    281381   indication.  */
     
    287387     name of the symbol which caused the archive element to be pulled
    288388     in.  */
    289   boolean (*add_archive_element) PARAMS ((struct bfd_link_info *,
    290                                           bfd *abfd,
    291                                           const char *name));
     389  bfd_boolean (*add_archive_element)
     390    PARAMS ((struct bfd_link_info *, bfd *abfd, const char *name));
    292391  /* A function which is called when a symbol is found with multiple
    293392     definitions.  NAME is the symbol which is defined multiple times.
     
    296395     the new value.  OBFD may be NULL.  OSEC and NSEC may be
    297396     bfd_com_section or bfd_ind_section.  */
    298   boolean (*multiple_definition) PARAMS ((struct bfd_link_info *,
    299                                           const char *name,
    300                                           bfd *obfd,
    301                                           asection *osec,
    302                                           bfd_vma oval,
    303                                           bfd *nbfd,
    304                                           asection *nsec,
    305                                           bfd_vma nval));
     397  bfd_boolean (*multiple_definition)
     398    PARAMS ((struct bfd_link_info *, const char *name,
     399             bfd *obfd, asection *osec, bfd_vma oval,
     400             bfd *nbfd, asection *nsec, bfd_vma nval));
    306401  /* A function which is called when a common symbol is defined
    307402     multiple times.  NAME is the symbol appearing multiple times.
     
    315410     bfd_link_hash_indirect.  If NTYPE is bfd_link_hash_common, NSIZE
    316411     is the size of the new symbol.  */
    317   boolean (*multiple_common) PARAMS ((struct bfd_link_info *,
    318                                       const char *name,
    319                                       bfd *obfd,
    320                                       enum bfd_link_hash_type otype,
    321                                       bfd_vma osize,
    322                                       bfd *nbfd,
    323                                       enum bfd_link_hash_type ntype,
    324                                       bfd_vma nsize));
     412  bfd_boolean (*multiple_common)
     413    PARAMS ((struct bfd_link_info *, const char *name,
     414             bfd *obfd, enum bfd_link_hash_type otype, bfd_vma osize,
     415             bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize));
    325416  /* A function which is called to add a symbol to a set.  ENTRY is
    326417     the link hash table entry for the set itself (e.g.,
     
    329420     get the size of the entry when generating an executable file.
    330421     ABFD, SEC and VALUE identify the value to add to the set.  */
    331   boolean (*add_to_set) PARAMS ((struct bfd_link_info *,
    332                                 struct bfd_link_hash_entry *entry,
    333                                  bfd_reloc_code_real_type reloc,
    334                                  bfd *abfd, asection *sec, bfd_vma value));
     422  bfd_boolean (*add_to_set)
     423    PARAMS ((struct bfd_link_info *, struct bfd_link_hash_entry *entry,
     424             bfd_reloc_code_real_type reloc, bfd *abfd, asection *sec,
     425            bfd_vma value));
    335426  /* A function which is called when the name of a g++ constructor or
    336427     destructor is found.  This is only called by some object file
    337      formats.  CONSTRUCTOR is true for a constructor, false for a
     428     formats.  CONSTRUCTOR is TRUE for a constructor, FALSE for a
    338429     destructor.  This will use BFD_RELOC_CTOR when generating a
    339430     relocateable file.  NAME is the name of the symbol found.  ABFD,
    340431     SECTION and VALUE are the value of the symbol.  */
    341   boolean (*constructor) PARAMS ((struct bfd_link_info *,
    342                                   boolean constructor,
    343                                   const char *name, bfd *abfd, asection *sec,
    344                                   bfd_vma value));
     432  bfd_boolean (*constructor)
     433    PARAMS ((struct bfd_link_info *, bfd_boolean constructor,
     434             const char *name, bfd *abfd, asection *sec, bfd_vma value));
    345435  /* A function which is called to issue a linker warning.  For
    346436     example, this is called when there is a reference to a warning
     
    350440     which trigerred the warning; either ABFD or SECTION or both may
    351441     be NULL if the location is not known.  */
    352   boolean (*warning) PARAMS ((struct bfd_link_info *,
    353                               const char *warning, const char *symbol,
    354                               bfd *abfd, asection *section,
    355                               bfd_vma address));
     442  bfd_boolean (*warning)
     443    PARAMS ((struct bfd_link_info *, const char *warning, const char *symbol,
     444             bfd *abfd, asection *section, bfd_vma address));
    356445  /* A function which is called when a relocation is attempted against
    357446     an undefined symbol.  NAME is the symbol which is undefined.
     
    359448     reference is made. FATAL indicates whether an undefined symbol is
    360449     a fatal error or not. In some cases SECTION may be NULL.  */
    361   boolean (*undefined_symbol) PARAMS ((struct bfd_link_info *,
    362                                        const char *name, bfd *abfd,
    363                                        asection *section,
    364                                        bfd_vma address,
    365                                        boolean fatal));
     450  bfd_boolean (*undefined_symbol)
     451    PARAMS ((struct bfd_link_info *, const char *name, bfd *abfd,
     452             asection *section, bfd_vma address, bfd_boolean fatal));
    366453  /* A function which is called when a reloc overflow occurs.  NAME is
    367454     the name of the symbol or section the reloc is against,
     
    371458     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    372459     ABFD will be NULL.  */
    373   boolean (*reloc_overflow) PARAMS ((struct bfd_link_info *,
    374                                      const char *name,
    375                                      const char *reloc_name, bfd_vma addend,
    376                                      bfd *abfd, asection *section,
    377                                      bfd_vma address));
     460  bfd_boolean (*reloc_overflow)
     461    PARAMS ((struct bfd_link_info *, const char *name, const char *reloc_name,
     462             bfd_vma addend, bfd *abfd, asection *section, bfd_vma address));
    378463  /* A function which is called when a dangerous reloc is performed.
    379464     The canonical example is an a29k IHCONST reloc which does not
     
    383468     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    384469     ABFD will be NULL.  */
    385   boolean (*reloc_dangerous) PARAMS ((struct bfd_link_info *,
    386                                       const char *message,
    387                                       bfd *abfd, asection *section,
    388                                       bfd_vma address));
     470  bfd_boolean (*reloc_dangerous)
     471    PARAMS ((struct bfd_link_info *, const char *message,
     472             bfd *abfd, asection *section, bfd_vma address));
    389473  /* A function which is called when a reloc is found to be attached
    390474     to a symbol which is not being written out.  NAME is the name of
     
    393477     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
    394478     ABFD will be NULL.  */
    395   boolean (*unattached_reloc) PARAMS ((struct bfd_link_info *,
    396                                        const char *name,
    397                                        bfd *abfd, asection *section,
    398                                        bfd_vma address));
     479  bfd_boolean (*unattached_reloc)
     480    PARAMS ((struct bfd_link_info *, const char *name,
     481             bfd *abfd, asection *section, bfd_vma address));
    399482  /* A function which is called when a symbol in notice_hash is
    400483     defined or referenced.  NAME is the symbol.  ABFD, SECTION and
    401484     ADDRESS are the value of the symbol.  If SECTION is
    402485     bfd_und_section, this is a reference.  */
    403   boolean (*notice) PARAMS ((struct bfd_link_info *, const char *name,
    404                              bfd *abfd, asection *section, bfd_vma address));
     486  bfd_boolean (*notice)
     487    PARAMS ((struct bfd_link_info *, const char *name,
     488             bfd *abfd, asection *section, bfd_vma address));
     489  /* A function which is called for reporting a linker error. ID is the
     490     error identifier. The remaining input is the same as einfo () in
     491     ld.  */
     492  bfd_boolean (*error_handler)
     493    PARAMS ((int id, const char * fmt, ...));
    405494};
    406495
     
    415504  bfd_undefined_link_order,     /* Undefined.  */
    416505  bfd_indirect_link_order,      /* Built from a section.  */
    417   bfd_fill_link_order,          /* Fill with a 16 bit constant.  */
    418506  bfd_data_link_order,          /* Set to explicit data.  */
    419507  bfd_section_reloc_link_order, /* Relocate against a section.  */
     
    424512   attached to the section whose contents they are describing.  */
    425513
    426 struct bfd_link_order 
     514struct bfd_link_order
    427515{
    428516  /* Next link_order in chain.  */
     
    431519  enum bfd_link_order_type type;
    432520  /* Offset within output section.  */
    433   bfd_vma offset; 
     521  bfd_vma offset;
    434522  /* Size within output section.  */
    435523  bfd_size_type size;
    436524  /* Type specific information.  */
    437   union 
     525  union
    438526    {
    439       struct 
     527      struct
    440528        {
    441529          /* Section to include.  If this is used, then
     
    449537      struct
    450538        {
    451           /* Value to fill with.  */
    452           unsigned int value;
    453         } fill;
    454       struct
    455         {
    456           /* Data to put into file.  The size field gives the number
    457              of bytes which this field points to.  */
     539          /* Size of contents, or zero when contents size == size
     540             within output section.
     541             A non-zero value allows filling of the output section
     542             with an arbitrary repeated pattern.  */
     543          unsigned int size;
     544          /* Data to put into file.  */
    458545          bfd_byte *contents;
    459546        } data;
     
    521608  const char *pattern;
    522609  /* Matching function.  */
    523   int (*match) PARAMS((struct bfd_elf_version_expr *, const char *));
     610  int (*match) PARAMS ((struct bfd_elf_version_expr *, const char *));
     611  /* Defined by ".symver".  */
     612  unsigned int symver: 1;
     613  /* Defined by version script.  */
     614  unsigned int script : 1;
    524615};
    525616
Note: See TracChangeset for help on using the changeset viewer.