⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elf-bfd.h

📁 基于4个mips核的noc设计
💻 H
📖 第 1 页 / 共 4 页
字号:
/* BFD back-end data structures for ELF files.   Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001   Free Software Foundation, Inc.   Written by Cygnus Support.This file is part of BFD, the Binary File Descriptor library.This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License as published bythe Free Software Foundation; either version 2 of the License, or(at your option) any later version.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */#ifndef _LIBELF_H_#define _LIBELF_H_ 1#include "elf/common.h"#include "elf/internal.h"#include "elf/external.h"#include "bfdlink.h"/* The number of entries in a section is its size divided by the size   of a single entry.  This is normally only applicaable to reloc and   symbol table sections.  */#define NUM_SHDR_ENTRIES(shdr) ((shdr)->sh_size / (shdr)->sh_entsize)/* If size isn't specified as 64 or 32, NAME macro should fail.  */#ifndef NAME#if ARCH_SIZE==64#define NAME(x,y) CAT4(x,64,_,y)#endif#if ARCH_SIZE==32#define NAME(x,y) CAT4(x,32,_,y)#endif#endif#ifndef NAME#define NAME(x,y) CAT4(x,NOSIZE,_,y)#endif#define ElfNAME(X)	NAME(Elf,X)#define elfNAME(X)	NAME(elf,X)/* Information held for an ELF symbol.  The first field is the   corresponding asymbol.  Every symbol is an ELF file is actually a   pointer to this structure, although it is often handled as a   pointer to an asymbol.  */typedef struct{  /* The BFD symbol.  */  asymbol symbol;  /* ELF symbol information.  */  Elf_Internal_Sym internal_elf_sym;  /* Backend specific information.  */  union    {      unsigned int hppa_arg_reloc;      PTR mips_extr;      PTR any;    }  tc_data;  /* Version information.  This is from an Elf_Internal_Versym     structure in a SHT_GNU_versym section.  It is zero if there is no     version information.  */  unsigned short version;} elf_symbol_type;/* ELF linker hash table entries.  */struct elf_link_hash_entry{  struct bfd_link_hash_entry root;  /* Symbol index in output file.  This is initialized to -1.  It is     set to -2 if the symbol is used by a reloc.  */  long indx;  /* Symbol size.  */  bfd_size_type size;  /* Symbol index as a dynamic symbol.  Initialized to -1, and remains     -1 if this is not a dynamic symbol.  */  /* ??? Note that this is consistently used as a synonym for tests     against whether we can perform various simplifying transformations     to the code.  (E.g. changing a pc-relative jump to a PLT entry     into a pc-relative jump to the target function.)  That test, which     is often relatively complex, and someplaces wrong or incomplete,     should really be replaced by a predicate in elflink.c.     End result: this field -1 does not indicate that the symbol is     not in the dynamic symbol table, but rather that the symbol is     not visible outside this DSO.  */  long dynindx;  /* String table index in .dynstr if this is a dynamic symbol.  */  unsigned long dynstr_index;  /* If this is a weak defined symbol from a dynamic object, this     field points to a defined symbol with the same value, if there is     one.  Otherwise it is NULL.  */  struct elf_link_hash_entry *weakdef;  /* If this symbol requires an entry in the global offset table, the     processor specific backend uses this field to track usage and     final offset.  We use a union and two names primarily to document     the intent of any particular piece of code.  The field should be     used as a count until size_dynamic_sections, at which point the     contents of the .got is fixed.  Afterward, if this field is -1,     then the symbol does not require a global offset table entry.  */  union    {      bfd_signed_vma refcount;      bfd_vma offset;    } got;  /* Same, but tracks a procedure linkage table entry.  */  union    {      bfd_signed_vma refcount;      bfd_vma offset;    } plt;  /* If this symbol is used in the linker created sections, the processor     specific backend uses this field to map the field into the offset     from the beginning of the section.  */  struct elf_linker_section_pointers *linker_section_pointer;  /* Version information.  */  union  {    /* This field is used for a symbol which is not defined in a       regular object.  It points to the version information read in       from the dynamic object.  */    Elf_Internal_Verdef *verdef;    /* This field is used for a symbol which is defined in a regular       object.  It is set up in size_dynamic_sections.  It points to       the version information we should write out for this symbol.  */    struct bfd_elf_version_tree *vertree;  } verinfo;  /* Virtual table entry use information.  This array is nominally of size     size/sizeof(target_void_pointer), though we have to be able to assume     and track a size while the symbol is still undefined.  It is indexed     via offset/sizeof(target_void_pointer).  */  size_t vtable_entries_size;  boolean *vtable_entries_used;  /* Virtual table derivation info.  */  struct elf_link_hash_entry *vtable_parent;  /* Symbol type (STT_NOTYPE, STT_OBJECT, etc.).  */  char type;  /* Symbol st_other value, symbol visibility.  */  unsigned char other;  /* Hash value of the name computed using the ELF hash function.  */  unsigned long elf_hash_value;  /* Some flags; legal values follow.  */  unsigned short elf_link_hash_flags;  /* Symbol is referenced by a non-shared object.  */#define ELF_LINK_HASH_REF_REGULAR 01  /* Symbol is defined by a non-shared object.  */#define ELF_LINK_HASH_DEF_REGULAR 02  /* Symbol is referenced by a shared object.  */#define ELF_LINK_HASH_REF_DYNAMIC 04  /* Symbol is defined by a shared object.  */#define ELF_LINK_HASH_DEF_DYNAMIC 010  /* Symbol has a non-weak reference from a non-shared object.  */#define ELF_LINK_HASH_REF_REGULAR_NONWEAK 020  /* Dynamic symbol has been adjustd.  */#define ELF_LINK_HASH_DYNAMIC_ADJUSTED 040  /* Symbol needs a copy reloc.  */#define ELF_LINK_HASH_NEEDS_COPY 0100  /* Symbol needs a procedure linkage table entry.  */#define ELF_LINK_HASH_NEEDS_PLT 0200  /* Symbol appears in a non-ELF input file.  */#define ELF_LINK_NON_ELF 0400  /* Symbol should be marked as hidden in the version information.  */#define ELF_LINK_HIDDEN 01000  /* Symbol was forced to local scope due to a version script file.  */#define ELF_LINK_FORCED_LOCAL 02000  /* Symbol was marked during garbage collection.  */#define ELF_LINK_HASH_MARK 04000  /* Symbol is referenced by a non-GOT/non-PLT relocation.  This is     not currently set by all the backends.  */#define ELF_LINK_NON_GOT_REF 010000};/* Records local symbols to be emitted in the dynamic symbol table.  */struct elf_link_local_dynamic_entry{  struct elf_link_local_dynamic_entry *next;  /* The input bfd this symbol came from.  */  bfd *input_bfd;  /* The index of the local symbol being copied.  */  long input_indx;  /* The index in the outgoing dynamic symbol table.  */  long dynindx;  /* A copy of the input symbol.  */  Elf_Internal_Sym isym;};/* ELF linker hash table.  */struct elf_link_hash_table{  struct bfd_link_hash_table root;  /* Whether we have created the special dynamic sections required     when linking against or generating a shared object.  */  boolean dynamic_sections_created;  /* The BFD used to hold special sections created by the linker.     This will be the first BFD found which requires these sections to     be created.  */  bfd *dynobj;  /* The number of symbols found in the link which must be put into     the .dynsym section.  */  bfd_size_type dynsymcount;  /* The string table of dynamic symbols, which becomes the .dynstr     section.  */  struct bfd_strtab_hash *dynstr;  /* The number of buckets in the hash table in the .hash section.     This is based on the number of dynamic symbols.  */  bfd_size_type bucketcount;  /* A linked list of DT_NEEDED names found in dynamic objects     included in the link.  */  struct bfd_link_needed_list *needed;  /* The _GLOBAL_OFFSET_TABLE_ symbol.  */  struct elf_link_hash_entry *hgot;  /* A pointer to information used to link stabs in sections.  */  PTR stab_info;  /* A linked list of local symbols to be added to .dynsym.  */  struct elf_link_local_dynamic_entry *dynlocal;  /* A linked list of DT_RPATH/DT_RUNPATH names found in dynamic     objects included in the link.  */  struct bfd_link_needed_list *runpath;};/* Look up an entry in an ELF linker hash table.  */#define elf_link_hash_lookup(table, string, create, copy, follow)	\  ((struct elf_link_hash_entry *)					\   bfd_link_hash_lookup (&(table)->root, (string), (create),		\			 (copy), (follow)))/* Traverse an ELF linker hash table.  */#define elf_link_hash_traverse(table, func, info)			\  (bfd_link_hash_traverse						\   (&(table)->root,							\    (boolean (*) PARAMS ((struct bfd_link_hash_entry *, PTR))) (func),	\    (info)))/* Get the ELF linker hash table from a link_info structure.  */#define elf_hash_table(p) ((struct elf_link_hash_table *) ((p)->hash))/* Constant information held for an ELF backend.  */struct elf_size_info {  unsigned char sizeof_ehdr, sizeof_phdr, sizeof_shdr;  unsigned char sizeof_rel, sizeof_rela, sizeof_sym, sizeof_dyn, sizeof_note;  /* The size of entries in the .hash section.  */  unsigned char sizeof_hash_entry;  /* The number of internal relocations to allocate per external     relocation entry.  */  unsigned char int_rels_per_ext_rel;  unsigned char arch_size, file_align;  unsigned char elfclass, ev_current;  int (*write_out_phdrs) PARAMS ((bfd *, const Elf_Internal_Phdr *, int));  boolean (*write_shdrs_and_ehdr) PARAMS ((bfd *));  void (*write_relocs) PARAMS ((bfd *, asection *, PTR));  void (*swap_symbol_out) PARAMS ((bfd *, const Elf_Internal_Sym *, PTR));  boolean (*slurp_reloc_table)    PARAMS ((bfd *, asection *, asymbol **, boolean));  long (*slurp_symbol_table) PARAMS ((bfd *, asymbol **, boolean));  void (*swap_dyn_in) PARAMS ((bfd *, const PTR, Elf_Internal_Dyn *));  void (*swap_dyn_out) PARAMS ((bfd *, const Elf_Internal_Dyn *, PTR));  /* This function, if defined, is called to swap in a REL     relocation.  If an external relocation corresponds to more than     one internal relocation, then all relocations are swapped in at     once.  */  void (*swap_reloc_in)    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rel *));  /* This function, if defined, is called to swap out a REL     relocation.  */  void (*swap_reloc_out)    PARAMS ((bfd *, const Elf_Internal_Rel *, bfd_byte *));  /* This function, if defined, is called to swap in a RELA     relocation.  If an external relocation corresponds to more than     one internal relocation, then all relocations are swapped in at     once.  */  void (*swap_reloca_in)    PARAMS ((bfd *, const bfd_byte *, Elf_Internal_Rela *));  /* This function, if defined, is called to swap out a RELA     relocation.  */  void (*swap_reloca_out)    PARAMS ((bfd *, const Elf_Internal_Rela *, bfd_byte *));};#define elf_symbol_from(ABFD,S) \	(((S)->the_bfd->xvec->flavour == bfd_target_elf_flavour \	  && (S)->the_bfd->tdata.elf_obj_data != 0) \	 ? (elf_symbol_type *) (S) \	 : 0)struct elf_backend_data{  /* The architecture for this backend.  */  enum bfd_architecture arch;  /* The ELF machine code (EM_xxxx) for this backend.  */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -