coffcode.h
来自「基于4个mips核的noc设计」· C头文件 代码 · 共 2,097 行 · 第 1/5 页
H
2,097 行
. arelent *reloc,. bfd_byte *data,. unsigned int *src_ptr,. unsigned int *dst_ptr));. int (*_bfd_coff_reloc16_estimate) PARAMS ((. bfd *abfd,. asection *input_section,. arelent *r,. unsigned int shrink,. struct bfd_link_info *link_info));. enum coff_symbol_classification (*_bfd_coff_classify_symbol) PARAMS ((. bfd *abfd,. struct internal_syment *));. boolean (*_bfd_coff_compute_section_file_positions) PARAMS ((. bfd *abfd));. boolean (*_bfd_coff_start_final_link) PARAMS ((. bfd *output_bfd,. struct bfd_link_info *info));. boolean (*_bfd_coff_relocate_section) PARAMS ((. bfd *output_bfd,. struct bfd_link_info *info,. bfd *input_bfd,. asection *input_section,. bfd_byte *contents,. struct internal_reloc *relocs,. struct internal_syment *syms,. asection **sections));. reloc_howto_type *(*_bfd_coff_rtype_to_howto) PARAMS ((. bfd *abfd,. asection *sec,. struct internal_reloc *rel,. struct coff_link_hash_entry *h,. struct internal_syment *sym,. bfd_vma *addendp));. boolean (*_bfd_coff_adjust_symndx) PARAMS ((. bfd *obfd,. struct bfd_link_info *info,. bfd *ibfd,. asection *sec,. struct internal_reloc *reloc,. boolean *adjustedp));. boolean (*_bfd_coff_link_add_one_symbol) PARAMS ((. struct bfd_link_info *info,. bfd *abfd,. const char *name,. flagword flags,. asection *section,. bfd_vma value,. const char *string,. boolean copy,. boolean collect,. struct bfd_link_hash_entry **hashp));.. boolean (*_bfd_coff_link_output_has_begun) PARAMS ((. bfd * abfd,. struct coff_final_link_info * pfinfo));. boolean (*_bfd_coff_final_link_postscript) PARAMS ((. bfd * abfd,. struct coff_final_link_info * pfinfo));..} bfd_coff_backend_data;..#define coff_backend_info(abfd) ((bfd_coff_backend_data *) (abfd)->xvec->backend_data)..#define bfd_coff_swap_aux_in(a,e,t,c,ind,num,i) \. ((coff_backend_info (a)->_bfd_coff_swap_aux_in) (a,e,t,c,ind,num,i))..#define bfd_coff_swap_sym_in(a,e,i) \. ((coff_backend_info (a)->_bfd_coff_swap_sym_in) (a,e,i))..#define bfd_coff_swap_lineno_in(a,e,i) \. ((coff_backend_info ( a)->_bfd_coff_swap_lineno_in) (a,e,i))..#define bfd_coff_swap_reloc_out(abfd, i, o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_out) (abfd, i, o))..#define bfd_coff_swap_lineno_out(abfd, i, o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_lineno_out) (abfd, i, o))..#define bfd_coff_swap_aux_out(a,i,t,c,ind,num,o) \. ((coff_backend_info (a)->_bfd_coff_swap_aux_out) (a,i,t,c,ind,num,o))..#define bfd_coff_swap_sym_out(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_sym_out) (abfd, i, o))..#define bfd_coff_swap_scnhdr_out(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_out) (abfd, i, o))..#define bfd_coff_swap_filehdr_out(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_out) (abfd, i, o))..#define bfd_coff_swap_aouthdr_out(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_out) (abfd, i, o))..#define bfd_coff_filhsz(abfd) (coff_backend_info (abfd)->_bfd_filhsz).#define bfd_coff_aoutsz(abfd) (coff_backend_info (abfd)->_bfd_aoutsz).#define bfd_coff_scnhsz(abfd) (coff_backend_info (abfd)->_bfd_scnhsz).#define bfd_coff_symesz(abfd) (coff_backend_info (abfd)->_bfd_symesz).#define bfd_coff_auxesz(abfd) (coff_backend_info (abfd)->_bfd_auxesz).#define bfd_coff_relsz(abfd) (coff_backend_info (abfd)->_bfd_relsz).#define bfd_coff_linesz(abfd) (coff_backend_info (abfd)->_bfd_linesz).#define bfd_coff_filnmlen(abfd) (coff_backend_info (abfd)->_bfd_filnmlen).#define bfd_coff_long_filenames(abfd) (coff_backend_info (abfd)->_bfd_coff_long_filenames).#define bfd_coff_long_section_names(abfd) \. (coff_backend_info (abfd)->_bfd_coff_long_section_names).#define bfd_coff_default_section_alignment_power(abfd) \. (coff_backend_info (abfd)->_bfd_coff_default_section_alignment_power).#define bfd_coff_swap_filehdr_in(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_filehdr_in) (abfd, i, o))..#define bfd_coff_swap_aouthdr_in(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_aouthdr_in) (abfd, i, o))..#define bfd_coff_swap_scnhdr_in(abfd, i,o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_scnhdr_in) (abfd, i, o))..#define bfd_coff_swap_reloc_in(abfd, i, o) \. ((coff_backend_info (abfd)->_bfd_coff_swap_reloc_in) (abfd, i, o))..#define bfd_coff_bad_format_hook(abfd, filehdr) \. ((coff_backend_info (abfd)->_bfd_coff_bad_format_hook) (abfd, filehdr))..#define bfd_coff_set_arch_mach_hook(abfd, filehdr)\. ((coff_backend_info (abfd)->_bfd_coff_set_arch_mach_hook) (abfd, filehdr)).#define bfd_coff_mkobject_hook(abfd, filehdr, aouthdr)\. ((coff_backend_info (abfd)->_bfd_coff_mkobject_hook) (abfd, filehdr, aouthdr))..#define bfd_coff_styp_to_sec_flags_hook(abfd, scnhdr, name, section)\. ((coff_backend_info (abfd)->_bfd_styp_to_sec_flags_hook)\. (abfd, scnhdr, name, section))..#define bfd_coff_set_alignment_hook(abfd, sec, scnhdr)\. ((coff_backend_info (abfd)->_bfd_set_alignment_hook) (abfd, sec, scnhdr))..#define bfd_coff_slurp_symbol_table(abfd)\. ((coff_backend_info (abfd)->_bfd_coff_slurp_symbol_table) (abfd))..#define bfd_coff_symname_in_debug(abfd, sym)\. ((coff_backend_info (abfd)->_bfd_coff_symname_in_debug) (abfd, sym))..#define bfd_coff_force_symnames_in_strings(abfd)\. (coff_backend_info (abfd)->_bfd_coff_force_symnames_in_strings)..#define bfd_coff_debug_string_prefix_length(abfd)\. (coff_backend_info (abfd)->_bfd_coff_debug_string_prefix_length)..#define bfd_coff_print_aux(abfd, file, base, symbol, aux, indaux)\. ((coff_backend_info (abfd)->_bfd_coff_print_aux)\. (abfd, file, base, symbol, aux, indaux))..#define bfd_coff_reloc16_extra_cases(abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr)\. ((coff_backend_info (abfd)->_bfd_coff_reloc16_extra_cases)\. (abfd, link_info, link_order, reloc, data, src_ptr, dst_ptr))..#define bfd_coff_reloc16_estimate(abfd, section, reloc, shrink, link_info)\. ((coff_backend_info (abfd)->_bfd_coff_reloc16_estimate)\. (abfd, section, reloc, shrink, link_info))..#define bfd_coff_classify_symbol(abfd, sym)\. ((coff_backend_info (abfd)->_bfd_coff_classify_symbol)\. (abfd, sym))..#define bfd_coff_compute_section_file_positions(abfd)\. ((coff_backend_info (abfd)->_bfd_coff_compute_section_file_positions)\. (abfd))..#define bfd_coff_start_final_link(obfd, info)\. ((coff_backend_info (obfd)->_bfd_coff_start_final_link)\. (obfd, info)).#define bfd_coff_relocate_section(obfd,info,ibfd,o,con,rel,isyms,secs)\. ((coff_backend_info (ibfd)->_bfd_coff_relocate_section)\. (obfd, info, ibfd, o, con, rel, isyms, secs)).#define bfd_coff_rtype_to_howto(abfd, sec, rel, h, sym, addendp)\. ((coff_backend_info (abfd)->_bfd_coff_rtype_to_howto)\. (abfd, sec, rel, h, sym, addendp)).#define bfd_coff_adjust_symndx(obfd, info, ibfd, sec, rel, adjustedp)\. ((coff_backend_info (abfd)->_bfd_coff_adjust_symndx)\. (obfd, info, ibfd, sec, rel, adjustedp)).#define bfd_coff_link_add_one_symbol(info,abfd,name,flags,section,value,string,cp,coll,hashp)\. ((coff_backend_info (abfd)->_bfd_coff_link_add_one_symbol)\. (info, abfd, name, flags, section, value, string, cp, coll, hashp))..#define bfd_coff_link_output_has_begun(a,p) \. ((coff_backend_info (a)->_bfd_coff_link_output_has_begun) (a,p)).#define bfd_coff_final_link_postscript(a,p) \. ((coff_backend_info (a)->_bfd_coff_final_link_postscript) (a,p)).*//* See whether the magic number matches. */static booleancoff_bad_format_hook (abfd, filehdr) bfd * abfd ATTRIBUTE_UNUSED; PTR filehdr;{ struct internal_filehdr *internal_f = (struct internal_filehdr *) filehdr; if (BADMAG (*internal_f)) return false; /* if the optional header is NULL or not the correct size then quit; the only difference I can see between m88k dgux headers (MC88DMAGIC) and Intel 960 readwrite headers (I960WRMAGIC) is that the optional header is of a different size. But the mips keeps extra stuff in it's opthdr, so dont check when doing that */#if defined(M88) || defined(I960) if (internal_f->f_opthdr != 0 && bfd_coff_aoutsz (abfd) != internal_f->f_opthdr) return false;#endif return true;}/* Check whether this section uses an alignment other than the default. */static voidcoff_set_custom_section_alignment (abfd, section, alignment_table, table_size) bfd *abfd ATTRIBUTE_UNUSED; asection *section; const struct coff_section_alignment_entry *alignment_table; const unsigned int table_size;{ const unsigned int default_alignment = COFF_DEFAULT_SECTION_ALIGNMENT_POWER; unsigned int i; for (i = 0; i < table_size; ++i) { const char *secname = bfd_get_section_name (abfd, section); if (alignment_table[i].comparison_length == (unsigned int) -1 ? strcmp (alignment_table[i].name, secname) == 0 : strncmp (alignment_table[i].name, secname, alignment_table[i].comparison_length) == 0) break; } if (i >= table_size) return; if (alignment_table[i].default_alignment_min != COFF_ALIGNMENT_FIELD_EMPTY && default_alignment < alignment_table[i].default_alignment_min) return; if (alignment_table[i].default_alignment_max != COFF_ALIGNMENT_FIELD_EMPTY && default_alignment > alignment_table[i].default_alignment_max) return; section->alignment_power = alignment_table[i].alignment_power;}/* Custom section alignment records. */static const struct coff_section_alignment_entrycoff_section_alignment_table[] ={#ifdef COFF_SECTION_ALIGNMENT_ENTRIES COFF_SECTION_ALIGNMENT_ENTRIES,#endif /* There must not be any gaps between .stabstr sections. */ { COFF_SECTION_NAME_PARTIAL_MATCH (".stabstr"), 1, COFF_ALIGNMENT_FIELD_EMPTY, 0 }, /* The .stab section must be aligned to 2**2 at most, to avoid gaps. */ { COFF_SECTION_NAME_PARTIAL_MATCH (".stab"), 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, /* Similarly for the .ctors and .dtors sections. */ { COFF_SECTION_NAME_EXACT_MATCH (".ctors"), 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }, { COFF_SECTION_NAME_EXACT_MATCH (".dtors"), 3, COFF_ALIGNMENT_FIELD_EMPTY, 2 }};static const unsigned int coff_section_alignment_table_size = sizeof coff_section_alignment_table / sizeof coff_section_alignment_table[0];/* Initialize a section structure with information peculiar to this particular implementation of COFF. */static booleancoff_new_section_hook (abfd, section) bfd * abfd; asection * section;{ combined_entry_type *native; section->alignment_power = COFF_DEFAULT_SECTION_ALIGNMENT_POWER;#ifdef RS6000COFF_C if (xcoff_data (abfd)->text_align_power != 0 && strcmp (bfd_get_section_name (abfd, section), ".text") == 0) section->alignment_power = xcoff_data (abfd)->text_align_power; if (xcoff_data (abfd)->data_align_power != 0 && strcmp (bfd_get_section_name (abfd, section), ".data") == 0) section->alignment_power = xcoff_data (abfd)->data_align_power;#endif /* Allocate aux records for section symbols, to store size and related info. @@ The 10 is a guess at a plausible maximum number of aux entries (but shouldn't be a constant). */ native = ((combined_entry_type *) bfd_zalloc (abfd, sizeof (combined_entry_type) * 10)); if (native == NULL) return false; /* We don't need to set up n_name, n_value, or n_scnum in the native symbol information, since they'll be overriden by the BFD symbol anyhow. However, we do need to set the type and storage class, in case this symbol winds up getting written out. The value 0 for n_numaux is already correct. */ native->u.syment.n_type = T_NULL; native->u.syment.n_sclass = C_STAT; coffsymbol (section->symbol)->native = native; coff_set_custom_section_alignment (abfd, section, coff_section_alignment_table, coff_section_alignment_table_size); return true;}#ifdef COFF_ALIGN_IN_SECTION_HEADER/* Set the alignment of a BFD section. */static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));static voidcoff_set_alignment_hook (abfd, section, scnhdr) bfd * abfd ATTRIBUTE_UNUSED; asection * section; PTR scnhdr;{ struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; unsigned int i;#ifdef I960 /* Extract ALIGN from 2**ALIGN stored in section header */ for (i = 0; i < 32; i++) if ((1 << i) >= hdr->s_align) break;#endif#ifdef TIC80COFF /* TI tools puts the alignment power in bits 8-11 */ i = (hdr->s_flags >> 8) & 0xF ;#endif#ifdef COFF_DECODE_ALIGNMENT i = COFF_DECODE_ALIGNMENT(hdr->s_flags);#endif section->alignment_power = i;#ifdef coff_set_section_load_page coff_set_section_load_page (section, hdr->s_page);#endif}#else /* ! COFF_ALIGN_IN_SECTION_HEADER */#ifdef COFF_WITH_PE/* a couple of macros to help setting the alignment power field */#define ALIGN_SET(field,x,y) \ if (((field) & IMAGE_SCN_ALIGN_64BYTES) == x )\ {\ section->alignment_power = y;\ }#define ELIFALIGN_SET(field,x,y) \ else if (( (field) & IMAGE_SCN_ALIGN_64BYTES) == x ) \ {\ section->alignment_power = y;\ }static void coff_set_alignment_hook PARAMS ((bfd *, asection *, PTR));static voidcoff_set_alignment_hook (abfd, section, scnhdr) bfd * abfd ATTRIBUTE_UNUSED; asection * section; PTR scnhdr;{ struct internal_scnhdr *hdr = (struct internal_scnhdr *) scnhdr; ALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_64BYTES, 6) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_32BYTES, 5) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_16BYTES, 4) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_8BYTES, 3) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_4BYTES, 2) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_2BYTES, 1) ELIFALIGN_SET (hdr->s_flags, IMAGE_SCN_ALIGN_1BYTES, 0) /* In a PE image file, the s_paddr field holds the virtual size of a section, while the s_size field holds the raw size. We also keep the original section flag value, since not every bit can be mapped onto a generic BFD section bit. */ if (coff_section_data (abfd, section) == NULL) { section->used_by_bfd = (PTR) bfd_zalloc (abfd, sizeof (struct coff_section_tdata)); if (section->used_by_bfd == NULL) { /* FIXME: Return error. */ abort (); } } if (pei_section_data (abfd, section) == NULL) { coff_section_data (abfd, section)->tdata = (PTR) bfd_zalloc (abfd, sizeof (struct pei_section_tdata)); if (coff_section_data (abfd, section)->tdata == NULL) { /* FIXME: Return error. */ abort (); } }
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?