Blame include/bfdlink.h

Packit bbfece
/* bfdlink.h -- header file for BFD link routines
Packit bbfece
   Copyright (C) 1993-2018 Free Software Foundation, Inc.
Packit bbfece
   Written by Steve Chamberlain and Ian Lance Taylor, Cygnus Support.
Packit bbfece
Packit bbfece
   This file is part of BFD, the Binary File Descriptor library.
Packit bbfece
Packit bbfece
   This program is free software; you can redistribute it and/or modify
Packit bbfece
   it under the terms of the GNU General Public License as published by
Packit bbfece
   the Free Software Foundation; either version 3 of the License, or
Packit bbfece
   (at your option) any later version.
Packit bbfece
Packit bbfece
   This program is distributed in the hope that it will be useful,
Packit bbfece
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit bbfece
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit bbfece
   GNU General Public License for more details.
Packit bbfece
Packit bbfece
   You should have received a copy of the GNU General Public License
Packit bbfece
   along with this program; if not, write to the Free Software
Packit bbfece
   Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
Packit bbfece
   MA 02110-1301, USA.  */
Packit bbfece
Packit bbfece
#ifndef BFDLINK_H
Packit bbfece
#define BFDLINK_H
Packit bbfece
Packit bbfece
/* Which symbols to strip during a link.  */
Packit bbfece
enum bfd_link_strip
Packit bbfece
{
Packit bbfece
  strip_none,		/* Don't strip any symbols.  */
Packit bbfece
  strip_debugger,	/* Strip debugging symbols.  */
Packit bbfece
  strip_some,		/* keep_hash is the list of symbols to keep.  */
Packit bbfece
  strip_all		/* Strip all symbols.  */
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Which local symbols to discard during a link.  This is irrelevant
Packit bbfece
   if strip_all is used.  */
Packit bbfece
enum bfd_link_discard
Packit bbfece
{
Packit bbfece
  discard_sec_merge,	/* Discard local temporary symbols in SEC_MERGE
Packit bbfece
			   sections.  */
Packit bbfece
  discard_none,		/* Don't discard any locals.  */
Packit bbfece
  discard_l,		/* Discard local temporary symbols.  */
Packit bbfece
  discard_all		/* Discard all locals.  */
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Whether to generate ELF common symbols with the STT_COMMON type
Packit bbfece
   during a relocatable link.  */
Packit bbfece
enum bfd_link_elf_stt_common
Packit bbfece
{
Packit bbfece
  unchanged,
Packit bbfece
  elf_stt_common,
Packit bbfece
  no_elf_stt_common
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Describes the type of hash table entry structure being used.
Packit bbfece
   Different hash table structure have different fields and so
Packit bbfece
   support different linking features.  */
Packit bbfece
enum bfd_link_hash_table_type
Packit bbfece
  {
Packit bbfece
    bfd_link_generic_hash_table,
Packit bbfece
    bfd_link_elf_hash_table
Packit bbfece
  };
Packit bbfece

Packit bbfece
/* These are the possible types of an entry in the BFD link hash
Packit bbfece
   table.  */
Packit bbfece
Packit bbfece
enum bfd_link_hash_type
Packit bbfece
{
Packit bbfece
  bfd_link_hash_new,		/* Symbol is new.  */
Packit bbfece
  bfd_link_hash_undefined,	/* Symbol seen before, but undefined.  */
Packit bbfece
  bfd_link_hash_undefweak,	/* Symbol is weak and undefined.  */
Packit bbfece
  bfd_link_hash_defined,	/* Symbol is defined.  */
Packit bbfece
  bfd_link_hash_defweak,	/* Symbol is weak and defined.  */
Packit bbfece
  bfd_link_hash_common,		/* Symbol is common.  */
Packit bbfece
  bfd_link_hash_indirect,	/* Symbol is an indirect link.  */
Packit bbfece
  bfd_link_hash_warning		/* Like indirect, but warn if referenced.  */
Packit bbfece
};
Packit bbfece
Packit bbfece
enum bfd_link_common_skip_ar_symbols
Packit bbfece
{
Packit bbfece
  bfd_link_common_skip_none,
Packit bbfece
  bfd_link_common_skip_text,
Packit bbfece
  bfd_link_common_skip_data,
Packit bbfece
  bfd_link_common_skip_all
Packit bbfece
};
Packit bbfece
Packit bbfece
struct bfd_link_hash_common_entry
Packit bbfece
  {
Packit bbfece
    unsigned int alignment_power;	/* Alignment.  */
Packit bbfece
    asection *section;		/* Symbol section.  */
Packit bbfece
  };
Packit bbfece
Packit bbfece
/* The linking routines use a hash table which uses this structure for
Packit bbfece
   its elements.  */
Packit bbfece
Packit bbfece
struct bfd_link_hash_entry
Packit bbfece
{
Packit bbfece
  /* Base hash table entry structure.  */
Packit bbfece
  struct bfd_hash_entry root;
Packit bbfece
Packit bbfece
  /* Type of this entry.  */
Packit bbfece
  ENUM_BITFIELD (bfd_link_hash_type) type : 8;
Packit bbfece
Packit bbfece
  /* Symbol is referenced in a normal regular object file,
Packit bbfece
     as distinct from a LTO IR object file.  */
Packit bbfece
  unsigned int non_ir_ref_regular : 1;
Packit bbfece
Packit bbfece
  /* Symbol is referenced in a normal dynamic object file,
Packit bbfece
     as distinct from a LTO IR object file.  */
Packit bbfece
  unsigned int non_ir_ref_dynamic : 1;
Packit bbfece
Packit bbfece
  /* Symbol is a built-in define.  These will be overridden by PROVIDE
Packit bbfece
     in a linker script.  */
Packit bbfece
  unsigned int linker_def : 1;
Packit bbfece
Packit bbfece
  /* Symbol defined in a linker script.  */
Packit bbfece
  unsigned int ldscript_def : 1;
Packit bbfece
Packit bbfece
  /* A union of information depending upon the type.  */
Packit bbfece
  union
Packit bbfece
    {
Packit bbfece
      /* Nothing is kept for bfd_hash_new.  */
Packit bbfece
      /* bfd_link_hash_undefined, bfd_link_hash_undefweak.  */
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  /* Undefined and common symbols are kept in a linked list through
Packit bbfece
	     this field.  This field is present in all of the union element
Packit bbfece
	     so that we don't need to remove entries from the list when we
Packit bbfece
	     change their type.  Removing entries would either require the
Packit bbfece
	     list to be doubly linked, which would waste more memory, or
Packit bbfece
	     require a traversal.  When an undefined or common symbol is
Packit bbfece
	     created, it should be added to this list, the head of which is in
Packit bbfece
	     the link hash table itself.  As symbols are defined, they need
Packit bbfece
	     not be removed from the list; anything which reads the list must
Packit bbfece
	     doublecheck the symbol type.
Packit bbfece
Packit bbfece
	     Weak symbols are not kept on this list.
Packit bbfece
Packit bbfece
	     Defined and defweak symbols use this field as a reference marker.
Packit bbfece
	     If the field is not NULL, or this structure is the tail of the
Packit bbfece
	     undefined symbol list, the symbol has been referenced.  If the
Packit bbfece
	     symbol is undefined and becomes defined, this field will
Packit bbfece
	     automatically be non-NULL since the symbol will have been on the
Packit bbfece
	     undefined symbol list.  */
Packit bbfece
	  struct bfd_link_hash_entry *next;
Packit bbfece
	  /* BFD symbol was found in.  */
Packit bbfece
	  bfd *abfd;
Packit bbfece
	} undef;
Packit bbfece
      /* bfd_link_hash_defined, bfd_link_hash_defweak.  */
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  struct bfd_link_hash_entry *next;
Packit bbfece
	  /* Symbol section.  */
Packit bbfece
	  asection *section;
Packit bbfece
	  /* Symbol value.  */
Packit bbfece
	  bfd_vma value;
Packit bbfece
	} def;
Packit bbfece
      /* bfd_link_hash_indirect, bfd_link_hash_warning.  */
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  struct bfd_link_hash_entry *next;
Packit bbfece
	  /* Real symbol.  */
Packit bbfece
	  struct bfd_link_hash_entry *link;
Packit bbfece
	  /* Warning message (bfd_link_hash_warning only).  */
Packit bbfece
	  const char *warning;
Packit bbfece
	} i;
Packit bbfece
      /* bfd_link_hash_common.  */
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  struct bfd_link_hash_entry *next;
Packit bbfece
	  /* The linker needs to know three things about common
Packit bbfece
	     symbols: the size, the alignment, and the section in
Packit bbfece
	     which the symbol should be placed.  We store the size
Packit bbfece
	     here, and we allocate a small structure to hold the
Packit bbfece
	     section and the alignment.  The alignment is stored as a
Packit bbfece
	     power of two.  We don't store all the information
Packit bbfece
	     directly because we don't want to increase the size of
Packit bbfece
	     the union; this structure is a major space user in the
Packit bbfece
	     linker.  */
Packit bbfece
	  struct bfd_link_hash_common_entry *p;
Packit bbfece
	  /* Common symbol size.  */
Packit bbfece
	  bfd_size_type size;
Packit bbfece
	} c;
Packit bbfece
    } u;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* This is the link hash table.  It is a derived class of
Packit bbfece
   bfd_hash_table.  */
Packit bbfece
Packit bbfece
struct bfd_link_hash_table
Packit bbfece
{
Packit bbfece
  /* The hash table itself.  */
Packit bbfece
  struct bfd_hash_table table;
Packit bbfece
  /* A linked list of undefined and common symbols, linked through the
Packit bbfece
     next field in the bfd_link_hash_entry structure.  */
Packit bbfece
  struct bfd_link_hash_entry *undefs;
Packit bbfece
  /* Entries are added to the tail of the undefs list.  */
Packit bbfece
  struct bfd_link_hash_entry *undefs_tail;
Packit bbfece
  /* Function to free the hash table on closing BFD.  */
Packit bbfece
  void (*hash_table_free) (bfd *);
Packit bbfece
  /* The type of the link hash table.  */
Packit bbfece
  enum bfd_link_hash_table_type type;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Look up an entry in a link hash table.  If FOLLOW is TRUE, this
Packit bbfece
   follows bfd_link_hash_indirect and bfd_link_hash_warning links to
Packit bbfece
   the real symbol.  */
Packit bbfece
extern struct bfd_link_hash_entry *bfd_link_hash_lookup
Packit bbfece
  (struct bfd_link_hash_table *, const char *, bfd_boolean create,
Packit bbfece
   bfd_boolean copy, bfd_boolean follow);
Packit bbfece
Packit bbfece
/* Look up an entry in the main linker hash table if the symbol might
Packit bbfece
   be wrapped.  This should only be used for references to an
Packit bbfece
   undefined symbol, not for definitions of a symbol.  */
Packit bbfece
Packit bbfece
extern struct bfd_link_hash_entry *bfd_wrapped_link_hash_lookup
Packit bbfece
  (bfd *, struct bfd_link_info *, const char *, bfd_boolean,
Packit bbfece
   bfd_boolean, bfd_boolean);
Packit bbfece
Packit bbfece
/* If H is a wrapped symbol, ie. the symbol name starts with "__wrap_"
Packit bbfece
   and the remainder is found in wrap_hash, return the real symbol.  */
Packit bbfece
Packit bbfece
extern struct bfd_link_hash_entry *unwrap_hash_lookup
Packit bbfece
  (struct bfd_link_info *, bfd *, struct bfd_link_hash_entry *);
Packit bbfece
Packit bbfece
/* Traverse a link hash table.  */
Packit bbfece
extern void bfd_link_hash_traverse
Packit bbfece
  (struct bfd_link_hash_table *,
Packit bbfece
    bfd_boolean (*) (struct bfd_link_hash_entry *, void *),
Packit bbfece
    void *);
Packit bbfece
Packit bbfece
/* Add an entry to the undefs list.  */
Packit bbfece
extern void bfd_link_add_undef
Packit bbfece
  (struct bfd_link_hash_table *, struct bfd_link_hash_entry *);
Packit bbfece
Packit bbfece
/* Remove symbols from the undefs list that don't belong there.  */
Packit bbfece
extern void bfd_link_repair_undef_list
Packit bbfece
  (struct bfd_link_hash_table *table);
Packit bbfece
Packit bbfece
/* Read symbols and cache symbol pointer array in outsymbols.  */
Packit bbfece
extern bfd_boolean bfd_generic_link_read_symbols (bfd *);
Packit bbfece
Packit bbfece
/* Check the relocs in the BFD.  Called after all the input
Packit bbfece
   files have been loaded, and garbage collection has tagged
Packit bbfece
   any unneeded sections.  */
Packit bbfece
extern bfd_boolean bfd_link_check_relocs (bfd *,struct bfd_link_info *);
Packit bbfece
Packit bbfece
struct bfd_sym_chain
Packit bbfece
{
Packit bbfece
  struct bfd_sym_chain *next;
Packit bbfece
  const char *name;
Packit bbfece
};
Packit bbfece

Packit bbfece
/* How to handle unresolved symbols.
Packit bbfece
   There are four possibilities which are enumerated below:  */
Packit bbfece
enum report_method
Packit bbfece
{
Packit bbfece
  /* This is the initial value when then link_info structure is created.
Packit bbfece
     It allows the various stages of the linker to determine whether they
Packit bbfece
     allowed to set the value.  */
Packit bbfece
  RM_NOT_YET_SET = 0,
Packit bbfece
  RM_IGNORE,
Packit bbfece
  RM_GENERATE_WARNING,
Packit bbfece
  RM_GENERATE_ERROR
Packit bbfece
};
Packit bbfece
Packit bbfece
typedef enum {with_flags, without_flags} flag_type;
Packit bbfece
Packit bbfece
/* A section flag list.  */
Packit bbfece
struct flag_info_list
Packit bbfece
{
Packit bbfece
  flag_type with;
Packit bbfece
  const char *name;
Packit bbfece
  bfd_boolean valid;
Packit bbfece
  struct flag_info_list *next;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Section flag info.  */
Packit bbfece
struct flag_info
Packit bbfece
{
Packit bbfece
  flagword only_with_flags;
Packit bbfece
  flagword not_with_flags;
Packit bbfece
  struct flag_info_list *flag_list;
Packit bbfece
  bfd_boolean flags_initialized;
Packit bbfece
};
Packit bbfece
Packit bbfece
struct bfd_elf_dynamic_list;
Packit bbfece
struct bfd_elf_version_tree;
Packit bbfece
Packit bbfece
/* Types of output.  */
Packit bbfece
Packit bbfece
enum output_type
Packit bbfece
{
Packit bbfece
  type_pde,
Packit bbfece
  type_pie,
Packit bbfece
  type_relocatable,
Packit bbfece
  type_dll,
Packit bbfece
};
Packit bbfece
Packit bbfece
#define bfd_link_pde(info)	   ((info)->type == type_pde)
Packit bbfece
#define bfd_link_dll(info)	   ((info)->type == type_dll)
Packit bbfece
#define bfd_link_relocatable(info) ((info)->type == type_relocatable)
Packit bbfece
#define bfd_link_pie(info)	   ((info)->type == type_pie)
Packit bbfece
#define bfd_link_executable(info)  (bfd_link_pde (info) || bfd_link_pie (info))
Packit bbfece
#define bfd_link_pic(info)	   (bfd_link_dll (info) || bfd_link_pie (info))
Packit bbfece
Packit bbfece
/* This structure holds all the information needed to communicate
Packit bbfece
   between BFD and the linker when doing a link.  */
Packit bbfece
Packit bbfece
struct bfd_link_info
Packit bbfece
{
Packit bbfece
  /* Output type.  */
Packit bbfece
  ENUM_BITFIELD (output_type) type : 2;
Packit bbfece
Packit bbfece
  /* TRUE if BFD should pre-bind symbols in a shared object.  */
Packit bbfece
  unsigned int symbolic: 1;
Packit bbfece
Packit bbfece
  /* TRUE if executable should not contain copy relocs.
Packit bbfece
     Setting this true may result in a non-sharable text segment.  */
Packit bbfece
  unsigned int nocopyreloc: 1;
Packit bbfece
Packit bbfece
  /* TRUE if BFD should export all symbols in the dynamic symbol table
Packit bbfece
     of an executable, rather than only those used.  */
Packit bbfece
  unsigned int export_dynamic: 1;
Packit bbfece
Packit bbfece
  /* TRUE if a default symbol version should be created and used for
Packit bbfece
     exported symbols.  */
Packit bbfece
  unsigned int create_default_symver: 1;
Packit bbfece
Packit bbfece
  /* TRUE if unreferenced sections should be removed.  */
Packit bbfece
  unsigned int gc_sections: 1;
Packit bbfece
Packit bbfece
  /* TRUE if exported symbols should be kept during section gc.  */
Packit bbfece
  unsigned int gc_keep_exported: 1;
Packit bbfece
Packit bbfece
  /* TRUE if every symbol should be reported back via the notice
Packit bbfece
     callback.  */
Packit bbfece
  unsigned int notice_all: 1;
Packit bbfece
Packit bbfece
  /* TRUE if the LTO plugin is active.  */
Packit bbfece
  unsigned int lto_plugin_active: 1;
Packit bbfece
Packit Service ee3e66
  /* TRUE if all LTO IR symbols have been read.  */
Packit Service ee3e66
  unsigned int lto_all_symbols_read : 1;
Packit Service ee3e66
Packit bbfece
  /* TRUE if global symbols in discarded sections should be stripped.  */
Packit bbfece
  unsigned int strip_discarded: 1;
Packit bbfece
Packit bbfece
  /* TRUE if all data symbols should be dynamic.  */
Packit bbfece
  unsigned int dynamic_data: 1;
Packit bbfece
Packit bbfece
  /* TRUE if section groups should be resolved.  */
Packit bbfece
  unsigned int resolve_section_groups: 1;
Packit bbfece
Packit bbfece
  /* Which symbols to strip.  */
Packit bbfece
  ENUM_BITFIELD (bfd_link_strip) strip : 2;
Packit bbfece
Packit bbfece
  /* Which local symbols to discard.  */
Packit bbfece
  ENUM_BITFIELD (bfd_link_discard) discard : 2;
Packit bbfece
Packit bbfece
  /* Whether to generate ELF common symbols with the STT_COMMON type.  */
Packit bbfece
  ENUM_BITFIELD (bfd_link_elf_stt_common) elf_stt_common : 2;
Packit bbfece
Packit bbfece
  /* Criteria for skipping symbols when determining
Packit bbfece
     whether to include an object from an archive. */
Packit bbfece
  ENUM_BITFIELD (bfd_link_common_skip_ar_symbols) common_skip_ar_symbols : 2;
Packit bbfece
Packit bbfece
  /* What to do with unresolved symbols in an object file.
Packit bbfece
     When producing executables the default is GENERATE_ERROR.
Packit bbfece
     When producing shared libraries the default is IGNORE.  The
Packit bbfece
     assumption with shared libraries is that the reference will be
Packit bbfece
     resolved at load/execution time.  */
Packit bbfece
  ENUM_BITFIELD (report_method) unresolved_syms_in_objects : 2;
Packit bbfece
Packit bbfece
  /* What to do with unresolved symbols in a shared library.
Packit bbfece
     The same defaults apply.  */
Packit bbfece
  ENUM_BITFIELD (report_method) unresolved_syms_in_shared_libs : 2;
Packit bbfece
Packit bbfece
  /* TRUE if shared objects should be linked directly, not shared.  */
Packit bbfece
  unsigned int static_link: 1;
Packit bbfece
Packit bbfece
  /* TRUE if symbols should be retained in memory, FALSE if they
Packit bbfece
     should be freed and reread.  */
Packit bbfece
  unsigned int keep_memory: 1;
Packit bbfece
Packit bbfece
  /* TRUE if BFD should generate relocation information in the final
Packit bbfece
     executable.  */
Packit bbfece
  unsigned int emitrelocations: 1;
Packit bbfece
Packit bbfece
  /* TRUE if PT_GNU_RELRO segment should be created.  */
Packit bbfece
  unsigned int relro: 1;
Packit bbfece
Packit bbfece
  /* TRUE if separate code segment should be created.  */
Packit bbfece
  unsigned int separate_code: 1;
Packit bbfece
Packit bbfece
  /* Nonzero if .eh_frame_hdr section and PT_GNU_EH_FRAME ELF segment
Packit bbfece
     should be created.  1 for DWARF2 tables, 2 for compact tables.  */
Packit bbfece
  unsigned int eh_frame_hdr_type: 2;
Packit bbfece
Packit bbfece
  /* TRUE if we should warn when adding a DT_TEXTREL to a shared object.  */
Packit bbfece
  unsigned int warn_shared_textrel: 1;
Packit bbfece
Packit bbfece
  /* TRUE if we should error when adding a DT_TEXTREL.  */
Packit bbfece
  unsigned int error_textrel: 1;
Packit bbfece
Packit bbfece
  /* TRUE if .hash section should be created.  */
Packit bbfece
  unsigned int emit_hash: 1;
Packit bbfece
Packit bbfece
  /* TRUE if .gnu.hash section should be created.  */
Packit bbfece
  unsigned int emit_gnu_hash: 1;
Packit bbfece
Packit bbfece
  /* If TRUE reduce memory overheads, at the expense of speed. This will
Packit bbfece
     cause map file generation to use an O(N^2) algorithm and disable
Packit bbfece
     caching ELF symbol buffer.  */
Packit bbfece
  unsigned int reduce_memory_overheads: 1;
Packit bbfece
Packit bbfece
  /* TRUE if the output file should be in a traditional format.  This
Packit bbfece
     is equivalent to the setting of the BFD_TRADITIONAL_FORMAT flag
Packit bbfece
     on the output file, but may be checked when reading the input
Packit bbfece
     files.  */
Packit bbfece
  unsigned int traditional_format: 1;
Packit bbfece
Packit bbfece
  /* TRUE if non-PLT relocs should be merged into one reloc section
Packit bbfece
     and sorted so that relocs against the same symbol come together.  */
Packit bbfece
  unsigned int combreloc: 1;
Packit bbfece
Packit bbfece
  /* TRUE if a default symbol version should be created and used for
Packit bbfece
     imported symbols.  */
Packit bbfece
  unsigned int default_imported_symver: 1;
Packit bbfece
Packit bbfece
  /* TRUE if the new ELF dynamic tags are enabled. */
Packit bbfece
  unsigned int new_dtags: 1;
Packit bbfece
Packit bbfece
  /* FALSE if .eh_frame unwind info should be generated for PLT and other
Packit bbfece
     linker created sections, TRUE if it should be omitted.  */
Packit bbfece
  unsigned int no_ld_generated_unwind_info: 1;
Packit bbfece
Packit bbfece
  /* TRUE if BFD should generate a "task linked" object file,
Packit bbfece
     similar to relocatable but also with globals converted to
Packit bbfece
     statics.  */
Packit bbfece
  unsigned int task_link: 1;
Packit bbfece
Packit bbfece
  /* TRUE if ok to have multiple definition.  */
Packit bbfece
  unsigned int allow_multiple_definition: 1;
Packit bbfece
Packit bbfece
  /* TRUE if .gnu_object_only section should be created.  */
Packit bbfece
  unsigned int emit_gnu_object_only: 1;
Packit bbfece
Packit bbfece
  /* TRUE if .gnu_object_only section is being created.  */
Packit bbfece
  unsigned int emitting_gnu_object_only: 1;
Packit bbfece
Packit bbfece
  /* TRUE if ok to have version with no definition.  */
Packit bbfece
  unsigned int allow_undefined_version: 1;
Packit bbfece
Packit bbfece
  /* TRUE if some symbols have to be dynamic, controlled by
Packit bbfece
     --dynamic-list command line options.  */
Packit bbfece
  unsigned int dynamic: 1;
Packit bbfece
Packit bbfece
  /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W|PF_X
Packit bbfece
     flags.  */
Packit bbfece
  unsigned int execstack: 1;
Packit bbfece
Packit bbfece
  /* TRUE if PT_GNU_STACK segment should be created with PF_R|PF_W
Packit bbfece
     flags.  */
Packit bbfece
  unsigned int noexecstack: 1;
Packit bbfece
Packit bbfece
  /* TRUE if we want to produced optimized output files.  This might
Packit bbfece
     need much more time and therefore must be explicitly selected.  */
Packit bbfece
  unsigned int optimize: 1;
Packit bbfece
Packit bbfece
  /* TRUE if user should be informed of removed unreferenced sections.  */
Packit bbfece
  unsigned int print_gc_sections: 1;
Packit bbfece
Packit bbfece
  /* TRUE if we should warn alternate ELF machine code.  */
Packit bbfece
  unsigned int warn_alternate_em: 1;
Packit bbfece
Packit bbfece
  /* TRUE if the linker script contained an explicit PHDRS command.  */
Packit bbfece
  unsigned int user_phdrs: 1;
Packit bbfece
Packit bbfece
  /* TRUE if we should check relocations after all input files have
Packit bbfece
     been opened.  */
Packit bbfece
  unsigned int check_relocs_after_open_input: 1;
Packit bbfece
Packit bbfece
  /* TRUE if BND prefix in PLT entries is always generated.  */
Packit bbfece
  unsigned int bndplt: 1;
Packit bbfece
Packit bbfece
  /* TRUE if IBT-enabled PLT entries should be generated.  */
Packit bbfece
  unsigned int ibtplt: 1;
Packit bbfece
Packit bbfece
  /* TRUE if GNU_PROPERTY_X86_FEATURE_1_IBT should be generated.  */
Packit bbfece
  unsigned int ibt: 1;
Packit bbfece
Packit bbfece
  /* TRUE if GNU_PROPERTY_X86_FEATURE_1_SHSTK should be generated.  */
Packit bbfece
  unsigned int shstk: 1;
Packit bbfece
Packit bbfece
  /* 0 = > no report, 1 => warn, 2=> error.  */
Packit bbfece
  unsigned int cet_report: 2;
Packit bbfece
Packit bbfece
  /* TRUE if generation of .interp/PT_INTERP should be suppressed.  */
Packit bbfece
  unsigned int nointerp: 1;
Packit bbfece
Packit bbfece
  /* TRUE if we shouldn't check relocation overflow.  */
Packit bbfece
  unsigned int no_reloc_overflow_check: 1;
Packit bbfece
Packit bbfece
  /* TRUE if generate a 1-byte NOP as suffix for x86 call instruction.  */
Packit bbfece
  unsigned int call_nop_as_suffix : 1;
Packit bbfece
Packit bbfece
  /* TRUE if common symbols should be treated as undefined.  */
Packit bbfece
  unsigned int inhibit_common_definition : 1;
Packit bbfece
Packit bbfece
  /* The 1-byte NOP for x86 call instruction.  */
Packit bbfece
  char call_nop_byte;
Packit bbfece
Packit bbfece
  /* Char that may appear as the first char of a symbol, but should be
Packit bbfece
     skipped (like symbol_leading_char) when looking up symbols in
Packit bbfece
     wrap_hash.  Used by PowerPC Linux for 'dot' symbols.  */
Packit bbfece
  char wrap_char;
Packit bbfece
Packit bbfece
  /* Separator between archive and filename in linker script filespecs.  */
Packit bbfece
  char path_separator;
Packit bbfece
Packit bbfece
  /* Compress DWARF debug sections.  */
Packit bbfece
  enum compressed_debug_section_type compress_debug;
Packit bbfece
Packit bbfece
  /* Default stack size.  Zero means default (often zero itself), -1
Packit bbfece
     means explicitly zero-sized.  */
Packit bbfece
  bfd_signed_vma stacksize;
Packit bbfece
Packit bbfece
  /* Enable or disable target specific optimizations.
Packit bbfece
Packit bbfece
     Not all targets have optimizations to enable.
Packit bbfece
Packit bbfece
     Normally these optimizations are disabled by default but some targets
Packit bbfece
     prefer to enable them by default.  So this field is a tri-state variable.
Packit bbfece
     The values are:
Packit bbfece
     
Packit bbfece
     zero: Enable the optimizations (either from --relax being specified on
Packit bbfece
       the command line or the backend's before_allocation emulation function.
Packit bbfece
       
Packit bbfece
     positive: The user has requested that these optimizations be disabled.
Packit bbfece
       (Via the --no-relax command line option).
Packit bbfece
Packit bbfece
     negative: The optimizations are disabled.  (Set when initializing the
Packit bbfece
       args_type structure in ldmain.c:main.  */
Packit bbfece
  signed int disable_target_specific_optimizations;
Packit bbfece
Packit bbfece
  /* Function callbacks.  */
Packit bbfece
  const struct bfd_link_callbacks *callbacks;
Packit bbfece
Packit bbfece
  /* Hash table handled by BFD.  */
Packit bbfece
  struct bfd_link_hash_table *hash;
Packit bbfece
Packit bbfece
  /* Hash table of symbols to keep.  This is NULL unless strip is
Packit bbfece
     strip_some.  */
Packit bbfece
  struct bfd_hash_table *keep_hash;
Packit bbfece
Packit bbfece
  /* Hash table of symbols to report back via the notice callback.  If
Packit bbfece
     this is NULL, and notice_all is FALSE, then no symbols are
Packit bbfece
     reported back.  */
Packit bbfece
  struct bfd_hash_table *notice_hash;
Packit bbfece
Packit bbfece
  /* Hash table of symbols which are being wrapped (the --wrap linker
Packit bbfece
     option).  If this is NULL, no symbols are being wrapped.  */
Packit bbfece
  struct bfd_hash_table *wrap_hash;
Packit bbfece
Packit bbfece
  /* Hash table of symbols which may be left unresolved during
Packit bbfece
     a link.  If this is NULL, no symbols can be left unresolved.  */
Packit bbfece
  struct bfd_hash_table *ignore_hash;
Packit bbfece
Packit bbfece
  /* The output BFD.  */
Packit bbfece
  bfd *output_bfd;
Packit bbfece
Packit bbfece
  /* The import library generated.  */
Packit bbfece
  bfd *out_implib_bfd;
Packit bbfece
Packit bbfece
  /* The list of input BFD's involved in the link.  These are chained
Packit bbfece
     together via the link.next field.  */
Packit bbfece
  bfd *input_bfds;
Packit bbfece
  bfd **input_bfds_tail;
Packit bbfece
Packit bbfece
  /* If a symbol should be created for each input BFD, this is section
Packit bbfece
     where those symbols should be placed.  It must be a section in
Packit bbfece
     the output BFD.  It may be NULL, in which case no such symbols
Packit bbfece
     will be created.  This is to support CREATE_OBJECT_SYMBOLS in the
Packit bbfece
     linker command language.  */
Packit bbfece
  asection *create_object_symbols_section;
Packit bbfece
Packit bbfece
  /* List of global symbol names that are starting points for marking
Packit bbfece
     sections against garbage collection.  */
Packit bbfece
  struct bfd_sym_chain *gc_sym_list;
Packit bbfece
Packit bbfece
  /* If a base output file is wanted, then this points to it */
Packit bbfece
  void *base_file;
Packit bbfece
Packit bbfece
  /* The function to call when the executable or shared object is
Packit bbfece
     loaded.  */
Packit bbfece
  const char *init_function;
Packit bbfece
Packit bbfece
  /* The function to call when the executable or shared object is
Packit bbfece
     unloaded.  */
Packit bbfece
  const char *fini_function;
Packit bbfece
Packit bbfece
  /* Number of relaxation passes.  Usually only one relaxation pass
Packit bbfece
     is needed.  But a backend can have as many relaxation passes as
Packit bbfece
     necessary.  During bfd_relax_section call, it is set to the
Packit bbfece
     current pass, starting from 0.  */
Packit bbfece
  int relax_pass;
Packit bbfece
Packit bbfece
  /* Number of relaxation trips.  This number is incremented every
Packit bbfece
     time the relaxation pass is restarted due to a previous
Packit bbfece
     relaxation returning true in *AGAIN.  */
Packit bbfece
  int relax_trip;
Packit bbfece
Packit bbfece
  /* > 0 to treat protected data defined in the shared library as
Packit bbfece
     reference external.  0 to treat it as internal.  -1 to let
Packit bbfece
     backend to decide.  */
Packit bbfece
  int extern_protected_data;
Packit bbfece
Packit bbfece
  /* 1 to make undefined weak symbols dynamic when building a dynamic
Packit bbfece
     object.  0 to resolve undefined weak symbols to zero.  -1 to let
Packit bbfece
     the backend decide.  */
Packit bbfece
  int dynamic_undefined_weak;
Packit bbfece
Packit bbfece
  /* Non-zero if auto-import thunks for DATA items in pei386 DLLs
Packit bbfece
     should be generated/linked against.  Set to 1 if this feature
Packit bbfece
     is explicitly requested by the user, -1 if enabled by default.  */
Packit bbfece
  int pei386_auto_import;
Packit bbfece
Packit bbfece
  /* Non-zero if runtime relocs for DATA items with non-zero addends
Packit bbfece
     in pei386 DLLs should be generated.  Set to 1 if this feature
Packit bbfece
     is explicitly requested by the user, -1 if enabled by default.  */
Packit bbfece
  int pei386_runtime_pseudo_reloc;
Packit bbfece
Packit bbfece
  /* How many spare .dynamic DT_NULL entries should be added?  */
Packit bbfece
  unsigned int spare_dynamic_tags;
Packit bbfece
Packit bbfece
  /* May be used to set DT_FLAGS for ELF. */
Packit bbfece
  bfd_vma flags;
Packit bbfece
Packit bbfece
  /* May be used to set DT_FLAGS_1 for ELF. */
Packit bbfece
  bfd_vma flags_1;
Packit bbfece
Packit bbfece
  /* Start and end of RELRO region.  */
Packit bbfece
  bfd_vma relro_start, relro_end;
Packit bbfece
Packit bbfece
  /* List of symbols should be dynamic.  */
Packit bbfece
  struct bfd_elf_dynamic_list *dynamic_list;
Packit bbfece
Packit bbfece
  /* The version information.  */
Packit bbfece
  struct bfd_elf_version_tree *version_info;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* This structures holds a set of callback functions.  These are called
Packit bbfece
   by the BFD linker routines.  */
Packit bbfece
Packit bbfece
struct bfd_link_callbacks
Packit bbfece
{
Packit bbfece
  /* A function which is called when an object is added from an
Packit bbfece
     archive.  ABFD is the archive element being added.  NAME is the
Packit bbfece
     name of the symbol which caused the archive element to be pulled
Packit bbfece
     in.  This function may set *SUBSBFD to point to an alternative
Packit bbfece
     BFD from which symbols should in fact be added in place of the
Packit bbfece
     original BFD's symbols.  Returns TRUE if the object should be
Packit bbfece
     added, FALSE if it should be skipped.  */
Packit bbfece
  bfd_boolean (*add_archive_element)
Packit bbfece
    (struct bfd_link_info *, bfd *abfd, const char *name, bfd **subsbfd);
Packit bbfece
  /* A function which is called when a symbol is found with multiple
Packit bbfece
     definitions.  H is the symbol which is defined multiple times.
Packit bbfece
     NBFD is the new BFD, NSEC is the new section, and NVAL is the new
Packit bbfece
     value.  NSEC may be bfd_com_section or bfd_ind_section.  */
Packit bbfece
  void (*multiple_definition)
Packit bbfece
    (struct bfd_link_info *, struct bfd_link_hash_entry *h,
Packit bbfece
     bfd *nbfd, asection *nsec, bfd_vma nval);
Packit bbfece
  /* A function which is called when a common symbol is defined
Packit bbfece
     multiple times.  H is the symbol appearing multiple times.
Packit bbfece
     NBFD is the BFD of the new symbol.  NTYPE is the type of the new
Packit bbfece
     symbol, one of bfd_link_hash_defined, bfd_link_hash_common, or
Packit bbfece
     bfd_link_hash_indirect.  If NTYPE is bfd_link_hash_common, NSIZE
Packit bbfece
     is the size of the new symbol.  */
Packit bbfece
  void (*multiple_common)
Packit bbfece
    (struct bfd_link_info *, struct bfd_link_hash_entry *h,
Packit bbfece
     bfd *nbfd, enum bfd_link_hash_type ntype, bfd_vma nsize);
Packit bbfece
  /* A function which is called to add a symbol to a set.  ENTRY is
Packit bbfece
     the link hash table entry for the set itself (e.g.,
Packit bbfece
     __CTOR_LIST__).  RELOC is the relocation to use for an entry in
Packit bbfece
     the set when generating a relocatable file, and is also used to
Packit bbfece
     get the size of the entry when generating an executable file.
Packit bbfece
     ABFD, SEC and VALUE identify the value to add to the set.  */
Packit bbfece
  void (*add_to_set)
Packit bbfece
    (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
Packit bbfece
     bfd_reloc_code_real_type reloc, bfd *abfd, asection *sec, bfd_vma value);
Packit bbfece
  /* A function which is called when the name of a g++ constructor or
Packit bbfece
     destructor is found.  This is only called by some object file
Packit bbfece
     formats.  CONSTRUCTOR is TRUE for a constructor, FALSE for a
Packit bbfece
     destructor.  This will use BFD_RELOC_CTOR when generating a
Packit bbfece
     relocatable file.  NAME is the name of the symbol found.  ABFD,
Packit bbfece
     SECTION and VALUE are the value of the symbol.  */
Packit bbfece
  void (*constructor)
Packit bbfece
    (struct bfd_link_info *, bfd_boolean constructor, const char *name,
Packit bbfece
     bfd *abfd, asection *sec, bfd_vma value);
Packit bbfece
  /* A function which is called to issue a linker warning.  For
Packit bbfece
     example, this is called when there is a reference to a warning
Packit bbfece
     symbol.  WARNING is the warning to be issued.  SYMBOL is the name
Packit bbfece
     of the symbol which triggered the warning; it may be NULL if
Packit bbfece
     there is none.  ABFD, SECTION and ADDRESS identify the location
Packit bbfece
     which trigerred the warning; either ABFD or SECTION or both may
Packit bbfece
     be NULL if the location is not known.  */
Packit bbfece
  void (*warning)
Packit bbfece
    (struct bfd_link_info *, const char *warning, const char *symbol,
Packit bbfece
     bfd *abfd, asection *section, bfd_vma address);
Packit bbfece
  /* A function which is called when a relocation is attempted against
Packit bbfece
     an undefined symbol.  NAME is the symbol which is undefined.
Packit bbfece
     ABFD, SECTION and ADDRESS identify the location from which the
Packit bbfece
     reference is made. IS_FATAL indicates whether an undefined symbol is
Packit bbfece
     a fatal error or not. In some cases SECTION may be NULL.  */
Packit bbfece
  void (*undefined_symbol)
Packit bbfece
    (struct bfd_link_info *, const char *name, bfd *abfd,
Packit bbfece
     asection *section, bfd_vma address, bfd_boolean is_fatal);
Packit bbfece
  /* A function which is called when a reloc overflow occurs. ENTRY is
Packit bbfece
     the link hash table entry for the symbol the reloc is against.
Packit bbfece
     NAME is the name of the local symbol or section the reloc is
Packit bbfece
     against, RELOC_NAME is the name of the relocation, and ADDEND is
Packit bbfece
     any addend that is used.  ABFD, SECTION and ADDRESS identify the
Packit bbfece
     location at which the overflow occurs; if this is the result of a
Packit bbfece
     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
Packit bbfece
     ABFD will be NULL.  */
Packit bbfece
  void (*reloc_overflow)
Packit bbfece
    (struct bfd_link_info *, struct bfd_link_hash_entry *entry,
Packit bbfece
     const char *name, const char *reloc_name, bfd_vma addend,
Packit bbfece
     bfd *abfd, asection *section, bfd_vma address);
Packit bbfece
  /* A function which is called when a dangerous reloc is performed.
Packit bbfece
     MESSAGE is an appropriate message.
Packit bbfece
     ABFD, SECTION and ADDRESS identify the location at which the
Packit bbfece
     problem occurred; if this is the result of a
Packit bbfece
     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
Packit bbfece
     ABFD will be NULL.  */
Packit bbfece
  void (*reloc_dangerous)
Packit bbfece
    (struct bfd_link_info *, const char *message,
Packit bbfece
     bfd *abfd, asection *section, bfd_vma address);
Packit bbfece
  /* A function which is called when a reloc is found to be attached
Packit bbfece
     to a symbol which is not being written out.  NAME is the name of
Packit bbfece
     the symbol.  ABFD, SECTION and ADDRESS identify the location of
Packit bbfece
     the reloc; if this is the result of a
Packit bbfece
     bfd_section_reloc_link_order or bfd_symbol_reloc_link_order, then
Packit bbfece
     ABFD will be NULL.  */
Packit bbfece
  void (*unattached_reloc)
Packit bbfece
    (struct bfd_link_info *, const char *name,
Packit bbfece
     bfd *abfd, asection *section, bfd_vma address);
Packit bbfece
  /* A function which is called when a symbol in notice_hash is
Packit bbfece
     defined or referenced.  H is the symbol, INH the indirect symbol
Packit bbfece
     if applicable.  ABFD, SECTION and ADDRESS are the (new) value of
Packit bbfece
     the symbol.  If SECTION is bfd_und_section, this is a reference.
Packit bbfece
     FLAGS are the symbol BSF_* flags.  */
Packit bbfece
  bfd_boolean (*notice)
Packit bbfece
    (struct bfd_link_info *, struct bfd_link_hash_entry *h,
Packit bbfece
     struct bfd_link_hash_entry *inh,
Packit bbfece
     bfd *abfd, asection *section, bfd_vma address, flagword flags);
Packit bbfece
  /* Error or warning link info message.  */
Packit bbfece
  void (*einfo)
Packit bbfece
    (const char *fmt, ...);
Packit bbfece
  /* General link info message.  */
Packit bbfece
  void (*info)
Packit bbfece
    (const char *fmt, ...);
Packit bbfece
  /* Message to be printed in linker map file.  */
Packit bbfece
  void (*minfo)
Packit bbfece
    (const char *fmt, ...);
Packit bbfece
  /* This callback provides a chance for users of the BFD library to
Packit bbfece
     override its decision about whether to place two adjacent sections
Packit bbfece
     into the same segment.  */
Packit bbfece
  bfd_boolean (*override_segment_assignment)
Packit bbfece
    (struct bfd_link_info *, bfd * abfd,
Packit bbfece
     asection * current_section, asection * previous_section,
Packit bbfece
     bfd_boolean new_segment);
Packit bbfece
};
Packit bbfece

Packit bbfece
/* The linker builds link_order structures which tell the code how to
Packit bbfece
   include input data in the output file.  */
Packit bbfece
Packit bbfece
/* These are the types of link_order structures.  */
Packit bbfece
Packit bbfece
enum bfd_link_order_type
Packit bbfece
{
Packit bbfece
  bfd_undefined_link_order,	/* Undefined.  */
Packit bbfece
  bfd_indirect_link_order,	/* Built from a section.  */
Packit bbfece
  bfd_data_link_order,		/* Set to explicit data.  */
Packit bbfece
  bfd_section_reloc_link_order,	/* Relocate against a section.  */
Packit bbfece
  bfd_symbol_reloc_link_order	/* Relocate against a symbol.  */
Packit bbfece
};
Packit bbfece
Packit bbfece
/* This is the link_order structure itself.  These form a chain
Packit bbfece
   attached to the output section whose contents they are describing.  */
Packit bbfece
Packit bbfece
struct bfd_link_order
Packit bbfece
{
Packit bbfece
  /* Next link_order in chain.  */
Packit bbfece
  struct bfd_link_order *next;
Packit bbfece
  /* Type of link_order.  */
Packit bbfece
  enum bfd_link_order_type type;
Packit bbfece
  /* Offset within output section.  */
Packit bbfece
  bfd_vma offset;
Packit bbfece
  /* Size within output section.  */
Packit bbfece
  bfd_size_type size;
Packit bbfece
  /* Type specific information.  */
Packit bbfece
  union
Packit bbfece
    {
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  /* Section to include.  If this is used, then
Packit bbfece
	     section->output_section must be the section the
Packit bbfece
	     link_order is attached to, section->output_offset must
Packit bbfece
	     equal the link_order offset field, and section->size
Packit bbfece
	     must equal the link_order size field.  Maybe these
Packit bbfece
	     restrictions should be relaxed someday.  */
Packit bbfece
	  asection *section;
Packit bbfece
	} indirect;
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  /* Size of contents, or zero when contents should be filled by
Packit bbfece
	     the architecture-dependent fill function.
Packit bbfece
	     A non-zero value allows filling of the output section
Packit bbfece
	     with an arbitrary repeated pattern.  */
Packit bbfece
	  unsigned int size;
Packit bbfece
	  /* Data to put into file.  */
Packit bbfece
	  bfd_byte *contents;
Packit bbfece
	} data;
Packit bbfece
      struct
Packit bbfece
	{
Packit bbfece
	  /* Description of reloc to generate.  Used for
Packit bbfece
	     bfd_section_reloc_link_order and
Packit bbfece
	     bfd_symbol_reloc_link_order.  */
Packit bbfece
	  struct bfd_link_order_reloc *p;
Packit bbfece
	} reloc;
Packit bbfece
    } u;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* A linker order of type bfd_section_reloc_link_order or
Packit bbfece
   bfd_symbol_reloc_link_order means to create a reloc against a
Packit bbfece
   section or symbol, respectively.  This is used to implement -Ur to
Packit bbfece
   generate relocs for the constructor tables.  The
Packit bbfece
   bfd_link_order_reloc structure describes the reloc that BFD should
Packit bbfece
   create.  It is similar to a arelent, but I didn't use arelent
Packit bbfece
   because the linker does not know anything about most symbols, and
Packit bbfece
   any asymbol structure it creates will be partially meaningless.
Packit bbfece
   This information could logically be in the bfd_link_order struct,
Packit bbfece
   but I didn't want to waste the space since these types of relocs
Packit bbfece
   are relatively rare.  */
Packit bbfece
Packit bbfece
struct bfd_link_order_reloc
Packit bbfece
{
Packit bbfece
  /* Reloc type.  */
Packit bbfece
  bfd_reloc_code_real_type reloc;
Packit bbfece
Packit bbfece
  union
Packit bbfece
    {
Packit bbfece
      /* For type bfd_section_reloc_link_order, this is the section
Packit bbfece
	 the reloc should be against.  This must be a section in the
Packit bbfece
	 output BFD, not any of the input BFDs.  */
Packit bbfece
      asection *section;
Packit bbfece
      /* For type bfd_symbol_reloc_link_order, this is the name of the
Packit bbfece
	 symbol the reloc should be against.  */
Packit bbfece
      const char *name;
Packit bbfece
    } u;
Packit bbfece
Packit bbfece
  /* Addend to use.  The object file should contain zero.  The BFD
Packit bbfece
     backend is responsible for filling in the contents of the object
Packit bbfece
     file correctly.  For some object file formats (e.g., COFF) the
Packit bbfece
     addend must be stored into in the object file, and for some
Packit bbfece
     (e.g., SPARC a.out) it is kept in the reloc.  */
Packit bbfece
  bfd_vma addend;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Allocate a new link_order for a section.  */
Packit bbfece
extern struct bfd_link_order *bfd_new_link_order (bfd *, asection *);
Packit bbfece
Packit bbfece
/* These structures are used to describe version information for the
Packit bbfece
   ELF linker.  These structures could be manipulated entirely inside
Packit bbfece
   BFD, but it would be a pain.  Instead, the regular linker sets up
Packit bbfece
   these structures, and then passes them into BFD.  */
Packit bbfece
Packit bbfece
/* Glob pattern for a version.  */
Packit bbfece
Packit bbfece
struct bfd_elf_version_expr
Packit bbfece
{
Packit bbfece
  /* Next glob pattern for this version.  */
Packit bbfece
  struct bfd_elf_version_expr *next;
Packit bbfece
  /* Glob pattern.  */
Packit bbfece
  const char *pattern;
Packit bbfece
  /* Set if pattern is not a glob.  */
Packit bbfece
  unsigned int literal : 1;
Packit bbfece
  /* Defined by ".symver".  */
Packit bbfece
  unsigned int symver : 1;
Packit bbfece
  /* Defined by version script.  */
Packit bbfece
  unsigned int script : 1;
Packit bbfece
  /* Pattern type.  */
Packit bbfece
#define BFD_ELF_VERSION_C_TYPE		1
Packit bbfece
#define BFD_ELF_VERSION_CXX_TYPE	2
Packit bbfece
#define BFD_ELF_VERSION_JAVA_TYPE	4
Packit bbfece
  unsigned int mask : 3;
Packit bbfece
};
Packit bbfece
Packit bbfece
struct bfd_elf_version_expr_head
Packit bbfece
{
Packit bbfece
  /* List of all patterns, both wildcards and non-wildcards.  */
Packit bbfece
  struct bfd_elf_version_expr *list;
Packit bbfece
  /* Hash table for non-wildcards.  */
Packit bbfece
  void *htab;
Packit bbfece
  /* Remaining patterns.  */
Packit bbfece
  struct bfd_elf_version_expr *remaining;
Packit bbfece
  /* What kind of pattern types are present in list (bitmask).  */
Packit bbfece
  unsigned int mask;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* Version dependencies.  */
Packit bbfece
Packit bbfece
struct bfd_elf_version_deps
Packit bbfece
{
Packit bbfece
  /* Next dependency for this version.  */
Packit bbfece
  struct bfd_elf_version_deps *next;
Packit bbfece
  /* The version which this version depends upon.  */
Packit bbfece
  struct bfd_elf_version_tree *version_needed;
Packit bbfece
};
Packit bbfece
Packit bbfece
/* A node in the version tree.  */
Packit bbfece
Packit bbfece
struct bfd_elf_version_tree
Packit bbfece
{
Packit bbfece
  /* Next version.  */
Packit bbfece
  struct bfd_elf_version_tree *next;
Packit bbfece
  /* Name of this version.  */
Packit bbfece
  const char *name;
Packit bbfece
  /* Version number.  */
Packit bbfece
  unsigned int vernum;
Packit bbfece
  /* Regular expressions for global symbols in this version.  */
Packit bbfece
  struct bfd_elf_version_expr_head globals;
Packit bbfece
  /* Regular expressions for local symbols in this version.  */
Packit bbfece
  struct bfd_elf_version_expr_head locals;
Packit bbfece
  /* List of versions which this version depends upon.  */
Packit bbfece
  struct bfd_elf_version_deps *deps;
Packit bbfece
  /* Index of the version name.  This is used within BFD.  */
Packit bbfece
  unsigned int name_indx;
Packit bbfece
  /* Whether this version tree was used.  This is used within BFD.  */
Packit bbfece
  int used;
Packit bbfece
  /* Matching hook.  */
Packit bbfece
  struct bfd_elf_version_expr *(*match)
Packit bbfece
    (struct bfd_elf_version_expr_head *head,
Packit bbfece
     struct bfd_elf_version_expr *prev, const char *sym);
Packit bbfece
};
Packit bbfece
Packit bbfece
struct bfd_elf_dynamic_list
Packit bbfece
{
Packit bbfece
  struct bfd_elf_version_expr_head head;
Packit bbfece
  struct bfd_elf_version_expr *(*match)
Packit bbfece
    (struct bfd_elf_version_expr_head *head,
Packit bbfece
     struct bfd_elf_version_expr *prev, const char *sym);
Packit bbfece
};
Packit bbfece
Packit bbfece
#endif