aout-tic30.c

来自「基于4个mips核的noc设计」· C语言 代码 · 共 1,065 行 · 第 1/3 页

C
1,065
字号
   offsets in the output file.  */static booleanMY_bfd_final_link (abfd, info)     bfd *abfd;     struct bfd_link_info *info;{  struct internal_exec *execp = exec_hdr (abfd);  file_ptr pos;  bfd_vma vma = 0;  int pad;  /* Set the executable header size to 0, as we don't want one for an     output.  */  adata (abfd).exec_bytes_size = 0;  pos = adata (abfd).exec_bytes_size;  /* Text.  */  vma = info->create_object_symbols_section->vma;  pos += vma;  obj_textsec (abfd)->filepos = pos;  obj_textsec (abfd)->vma = vma;  obj_textsec (abfd)->user_set_vma = 1;  pos += obj_textsec (abfd)->_raw_size;  vma += obj_textsec (abfd)->_raw_size;  /* Data.  */  if (abfd->flags & D_PAGED)    {      if (info->create_object_symbols_section->next->vma > 0)	obj_datasec (abfd)->vma = info->create_object_symbols_section->next->vma;      else	obj_datasec (abfd)->vma = BFD_ALIGN (vma, adata (abfd).segment_size);    }  else    {      obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);    }  if (obj_datasec (abfd)->vma < vma)    {      obj_datasec (abfd)->vma = BFD_ALIGN (vma, 4);    }  obj_datasec (abfd)->user_set_vma = 1;  vma = obj_datasec (abfd)->vma;  obj_datasec (abfd)->filepos = vma + adata (abfd).exec_bytes_size;  execp->a_text = vma - obj_textsec (abfd)->vma;  obj_textsec (abfd)->_raw_size = execp->a_text;  /* Since BSS follows data immediately, see if it needs alignment.  */  vma += obj_datasec (abfd)->_raw_size;  pad = align_power (vma, obj_bsssec (abfd)->alignment_power) - vma;  obj_datasec (abfd)->_raw_size += pad;  pos += obj_datasec (abfd)->_raw_size;  execp->a_data = obj_datasec (abfd)->_raw_size;  /* BSS.  */  obj_bsssec (abfd)->vma = vma;  obj_bsssec (abfd)->user_set_vma = 1;  /* We are fully resized, so don't readjust in final_link.  */  adata (abfd).magic = z_magic;  return NAME (aout, final_link) (abfd, info, MY_final_link_callback);}#endifenum machine_typetic30_aout_machine_type (arch, machine, unknown)     enum bfd_architecture arch;     unsigned long machine ATTRIBUTE_UNUSED;     boolean *unknown;{  enum machine_type arch_flags;  arch_flags = M_UNKNOWN;  *unknown = true;  switch (arch)    {    case bfd_arch_tic30:      *unknown = false;      break;    default:      arch_flags = M_UNKNOWN;    }  if (arch_flags != M_UNKNOWN)    *unknown = false;  return arch_flags;}booleantic30_aout_set_arch_mach (abfd, arch, machine)     bfd *abfd;     enum bfd_architecture arch;     unsigned long machine;{  if (!bfd_default_set_arch_mach (abfd, arch, machine))    return false;  if (arch != bfd_arch_unknown)    {      boolean unknown;      tic30_aout_machine_type (arch, machine, &unknown);      if (unknown)	return false;    }  obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;  return (*aout_backend_info (abfd)->set_sizes) (abfd);}/* We assume BFD generic archive files.  */#ifndef	MY_openr_next_archived_file#define	MY_openr_next_archived_file	bfd_generic_openr_next_archived_file#endif#ifndef MY_get_elt_at_index#define MY_get_elt_at_index		_bfd_generic_get_elt_at_index#endif#ifndef	MY_generic_stat_arch_elt#define	MY_generic_stat_arch_elt	bfd_generic_stat_arch_elt#endif#ifndef	MY_slurp_armap#define	MY_slurp_armap			bfd_slurp_bsd_armap#endif#ifndef	MY_slurp_extended_name_table#define	MY_slurp_extended_name_table	_bfd_slurp_extended_name_table#endif#ifndef MY_construct_extended_name_table#define MY_construct_extended_name_table \  _bfd_archive_bsd_construct_extended_name_table#endif#ifndef	MY_write_armap#define	MY_write_armap		bsd_write_armap#endif#ifndef MY_read_ar_hdr#define MY_read_ar_hdr		_bfd_generic_read_ar_hdr#endif#ifndef	MY_truncate_arname#define	MY_truncate_arname		bfd_bsd_truncate_arname#endif#ifndef MY_update_armap_timestamp#define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp#endif/* No core file defined here -- configure in trad-core.c separately.  */#ifndef	MY_core_file_failing_command#define	MY_core_file_failing_command _bfd_nocore_core_file_failing_command#endif#ifndef	MY_core_file_failing_signal#define	MY_core_file_failing_signal	_bfd_nocore_core_file_failing_signal#endif#ifndef	MY_core_file_matches_executable_p#define	MY_core_file_matches_executable_p	\				_bfd_nocore_core_file_matches_executable_p#endif#ifndef	MY_core_file_p#define	MY_core_file_p		_bfd_dummy_target#endif#ifndef MY_bfd_debug_info_start#define MY_bfd_debug_info_start		bfd_void#endif#ifndef MY_bfd_debug_info_end#define MY_bfd_debug_info_end		bfd_void#endif#ifndef MY_bfd_debug_info_accumulate#define MY_bfd_debug_info_accumulate	\			(void (*) PARAMS ((bfd*, struct sec *))) bfd_void#endif#ifndef MY_core_file_failing_command#define MY_core_file_failing_command NAME(aout,core_file_failing_command)#endif#ifndef MY_core_file_failing_signal#define MY_core_file_failing_signal NAME(aout,core_file_failing_signal)#endif#ifndef MY_core_file_matches_executable_p#define MY_core_file_matches_executable_p NAME(aout,core_file_matches_executable_p)#endif#ifndef MY_set_section_contents#define MY_set_section_contents NAME(aout,set_section_contents)#endif#ifndef MY_get_section_contents#define MY_get_section_contents aout_32_get_section_contents#endif#ifndef MY_get_section_contents_in_window#define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window#endif#ifndef MY_new_section_hook#define MY_new_section_hook NAME(aout,new_section_hook)#endif#ifndef MY_get_symtab_upper_bound#define MY_get_symtab_upper_bound NAME(aout,get_symtab_upper_bound)#endif#ifndef MY_get_symtab#define MY_get_symtab NAME(aout,get_symtab)#endif#ifndef MY_get_reloc_upper_bound#define MY_get_reloc_upper_bound NAME(aout,get_reloc_upper_bound)#endif#ifndef MY_canonicalize_reloc#define MY_canonicalize_reloc NAME(aout,canonicalize_reloc)#endif#ifndef MY_make_empty_symbol#define MY_make_empty_symbol NAME(aout,make_empty_symbol)#endif#ifndef MY_print_symbol#define MY_print_symbol NAME(aout,print_symbol)#endif#ifndef MY_get_symbol_info#define MY_get_symbol_info NAME(aout,get_symbol_info)#endif#ifndef MY_get_lineno#define MY_get_lineno NAME(aout,get_lineno)#endif#ifndef MY_set_arch_mach#define MY_set_arch_mach tic30_aout_set_arch_mach#endif#ifndef MY_find_nearest_line#define MY_find_nearest_line NAME(aout,find_nearest_line)#endif#ifndef MY_sizeof_headers#define MY_sizeof_headers NAME(aout,sizeof_headers)#endif#ifndef MY_bfd_get_relocated_section_contents#define MY_bfd_get_relocated_section_contents \			bfd_generic_get_relocated_section_contents#endif#ifndef MY_bfd_relax_section#define MY_bfd_relax_section bfd_generic_relax_section#endif#ifndef MY_bfd_gc_sections#define MY_bfd_gc_sections bfd_generic_gc_sections#endif#ifndef MY_bfd_reloc_type_lookup#define MY_bfd_reloc_type_lookup tic30_aout_reloc_type_lookup#endif#ifndef MY_bfd_make_debug_symbol#define MY_bfd_make_debug_symbol 0#endif#ifndef MY_read_minisymbols#define MY_read_minisymbols NAME(aout,read_minisymbols)#endif#ifndef MY_minisymbol_to_symbol#define MY_minisymbol_to_symbol NAME(aout,minisymbol_to_symbol)#endif#ifndef MY_bfd_link_hash_table_create#define MY_bfd_link_hash_table_create NAME(aout,link_hash_table_create)#endif#ifndef MY_bfd_link_add_symbols#define MY_bfd_link_add_symbols NAME(aout,link_add_symbols)#endif#ifndef MY_bfd_link_split_section#define MY_bfd_link_split_section  _bfd_generic_link_split_section#endif#ifndef MY_bfd_copy_private_bfd_data#define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data#endif#ifndef MY_bfd_merge_private_bfd_data#define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data#endif#ifndef MY_bfd_copy_private_symbol_data#define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data#endif#ifndef MY_bfd_print_private_bfd_data#define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data#endif#ifndef MY_bfd_set_private_flags#define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags#endif#ifndef MY_bfd_is_local_label_name#define MY_bfd_is_local_label_name bfd_generic_is_local_label_name#endif#ifndef MY_bfd_free_cached_info#define MY_bfd_free_cached_info NAME(aout,bfd_free_cached_info)#endif#ifndef MY_close_and_cleanup#define MY_close_and_cleanup MY_bfd_free_cached_info#endif#ifndef MY_get_dynamic_symtab_upper_bound#define MY_get_dynamic_symtab_upper_bound \  _bfd_nodynamic_get_dynamic_symtab_upper_bound#endif#ifndef MY_canonicalize_dynamic_symtab#define MY_canonicalize_dynamic_symtab \  _bfd_nodynamic_canonicalize_dynamic_symtab#endif#ifndef MY_get_dynamic_reloc_upper_bound#define MY_get_dynamic_reloc_upper_bound \  _bfd_nodynamic_get_dynamic_reloc_upper_bound#endif#ifndef MY_canonicalize_dynamic_reloc#define MY_canonicalize_dynamic_reloc \  _bfd_nodynamic_canonicalize_dynamic_reloc#endif/* Aout symbols normally have leading underscores */#ifndef MY_symbol_leading_char#define MY_symbol_leading_char '_'#endif/* Aout archives normally use spaces for padding */#ifndef AR_PAD_CHAR#define AR_PAD_CHAR ' '#endif#ifndef MY_BFD_TARGETconst bfd_target tic30_aout_vec ={  TARGETNAME,			/* name */  bfd_target_aout_flavour,  BFD_ENDIAN_BIG,		/* target byte order (big) */  BFD_ENDIAN_BIG,		/* target headers byte order (big) */  (HAS_RELOC |			/* object flags */   HAS_SYMS | HAS_LOCALS | WP_TEXT | D_PAGED),  (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC),	/* section flags */  MY_symbol_leading_char,  AR_PAD_CHAR,			/* ar_pad_char */  15,				/* ar_max_namelen */  bfd_getb64, bfd_getb_signed_64, bfd_putb64,  bfd_getb32, bfd_getb_signed_32, bfd_putb32,  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* data */  bfd_getb64, bfd_getb_signed_64, bfd_putb64,  bfd_getb32, bfd_getb_signed_32, bfd_putb32,  bfd_getb16, bfd_getb_signed_16, bfd_putb16,	/* hdrs */  {_bfd_dummy_target, MY_object_p,	/* bfd_check_format */   bfd_generic_archive_p, MY_core_file_p},  {bfd_false, MY_mkobject,	/* bfd_set_format */   _bfd_generic_mkarchive, bfd_false},  {bfd_false, MY_write_object_contents,		/* bfd_write_contents */   _bfd_write_archive_contents, bfd_false},  BFD_JUMP_TABLE_GENERIC (MY),  BFD_JUMP_TABLE_COPY (MY),  BFD_JUMP_TABLE_CORE (MY),  BFD_JUMP_TABLE_ARCHIVE (MY),  BFD_JUMP_TABLE_SYMBOLS (MY),  BFD_JUMP_TABLE_RELOCS (MY),  BFD_JUMP_TABLE_WRITE (MY),  BFD_JUMP_TABLE_LINK (MY),  BFD_JUMP_TABLE_DYNAMIC (MY),  NULL,  (PTR) MY_backend_data};#endif /* MY_BFD_TARGET */

⌨️ 快捷键说明

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