home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / binutils.7 / binutils / binutils-2.7 / bfd / elfxx-target.h < prev    next >
Encoding:
C/C++ Source or Header  |  1996-07-04  |  14.8 KB  |  461 lines

  1. /* Target definitions for NN-bit ELF
  2.    Copyright 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
  3.  
  4. This file is part of BFD, the Binary File Descriptor library.
  5.  
  6. This program is free software; you can redistribute it and/or modify
  7. it under the terms of the GNU General Public License as published by
  8. the Free Software Foundation; either version 2 of the License, or
  9. (at your option) any later version.
  10.  
  11. This program is distributed in the hope that it will be useful,
  12. but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. GNU General Public License for more details.
  15.  
  16. You should have received a copy of the GNU General Public License
  17. along with this program; if not, write to the Free Software
  18. Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
  19.  
  20. /* This structure contains everything that BFD knows about a target.
  21.    It includes things like its byte order, name, what routines to call
  22.    to do various operations, etc.  Every BFD points to a target structure
  23.    with its "xvec" member.
  24.  
  25.    There are two such structures here:  one for big-endian machines and
  26.    one for little-endian machines.   */
  27.  
  28. #define    bfd_elfNN_close_and_cleanup _bfd_generic_close_and_cleanup
  29. #define bfd_elfNN_bfd_free_cached_info _bfd_generic_bfd_free_cached_info
  30. #ifndef bfd_elfNN_get_section_contents
  31. #define bfd_elfNN_get_section_contents _bfd_generic_get_section_contents
  32. #endif
  33.  
  34. #define bfd_elfNN_canonicalize_dynamic_symtab _bfd_elf_canonicalize_dynamic_symtab
  35. #define bfd_elfNN_canonicalize_reloc    _bfd_elf_canonicalize_reloc
  36. #ifndef bfd_elfNN_find_nearest_line
  37. #define bfd_elfNN_find_nearest_line    _bfd_elf_find_nearest_line
  38. #endif
  39. #define bfd_elfNN_read_minisymbols    _bfd_elf_read_minisymbols
  40. #define bfd_elfNN_minisymbol_to_symbol    _bfd_elf_minisymbol_to_symbol
  41. #define bfd_elfNN_get_dynamic_symtab_upper_bound _bfd_elf_get_dynamic_symtab_upper_bound
  42. #define bfd_elfNN_get_lineno        _bfd_elf_get_lineno
  43. #ifndef bfd_elfNN_get_reloc_upper_bound
  44. #define bfd_elfNN_get_reloc_upper_bound _bfd_elf_get_reloc_upper_bound
  45. #endif
  46. #define bfd_elfNN_get_symbol_info    _bfd_elf_get_symbol_info
  47. #define bfd_elfNN_get_symtab        _bfd_elf_get_symtab
  48. #define bfd_elfNN_get_symtab_upper_bound _bfd_elf_get_symtab_upper_bound
  49. #if 0 /* done in elf-bfd.h */
  50. #define bfd_elfNN_link_record_dynamic_symbol _bfd_elf_link_record_dynamic_symbol
  51. #endif
  52. #define bfd_elfNN_make_empty_symbol    _bfd_elf_make_empty_symbol
  53. #define bfd_elfNN_new_section_hook    _bfd_elf_new_section_hook
  54. #define bfd_elfNN_set_arch_mach        _bfd_elf_set_arch_mach
  55. #ifndef bfd_elfNN_set_section_contents
  56. #define bfd_elfNN_set_section_contents    _bfd_elf_set_section_contents
  57. #endif
  58. #define bfd_elfNN_sizeof_headers    _bfd_elf_sizeof_headers
  59. #define bfd_elfNN_write_object_contents _bfd_elf_write_object_contents
  60.  
  61. #define bfd_elfNN_get_section_contents_in_window \
  62.   _bfd_generic_get_section_contents_in_window
  63.  
  64. #ifndef elf_backend_want_got_plt
  65. #define elf_backend_want_got_plt 0
  66. #endif
  67. #ifndef elf_backend_plt_readonly
  68. #define elf_backend_plt_readonly 0
  69. #endif
  70. #ifndef elf_backend_want_plt_sym
  71. #define elf_backend_want_plt_sym 0
  72. #endif
  73.  
  74. #define bfd_elfNN_bfd_debug_info_start    bfd_void
  75. #define bfd_elfNN_bfd_debug_info_end    bfd_void
  76. #define bfd_elfNN_bfd_debug_info_accumulate    (PROTO(void,(*),(bfd*, struct sec *))) bfd_void
  77.  
  78. #ifndef bfd_elfNN_bfd_get_relocated_section_contents
  79. #define bfd_elfNN_bfd_get_relocated_section_contents \
  80.  bfd_generic_get_relocated_section_contents
  81. #endif
  82.  
  83. #define bfd_elfNN_bfd_relax_section bfd_generic_relax_section
  84. #define bfd_elfNN_bfd_make_debug_symbol \
  85.   ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr)
  86.  
  87. #ifndef bfd_elfNN_bfd_copy_private_symbol_data
  88. #define bfd_elfNN_bfd_copy_private_symbol_data \
  89.   _bfd_elf_copy_private_symbol_data
  90. #endif
  91.  
  92. #ifndef bfd_elfNN_bfd_copy_private_section_data
  93. #define bfd_elfNN_bfd_copy_private_section_data \
  94.   _bfd_elf_copy_private_section_data
  95. #endif
  96. #ifndef bfd_elfNN_bfd_copy_private_bfd_data
  97. #define bfd_elfNN_bfd_copy_private_bfd_data \
  98.   ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
  99. #endif
  100. #ifndef bfd_elfNN_bfd_print_private_bfd_data
  101. #define bfd_elfNN_bfd_print_private_bfd_data \
  102.   _bfd_elf_print_private_bfd_data
  103. #endif
  104. #ifndef bfd_elfNN_bfd_merge_private_bfd_data
  105. #define bfd_elfNN_bfd_merge_private_bfd_data \
  106.   ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true)
  107. #endif
  108. #ifndef bfd_elfNN_bfd_set_private_flags
  109. #define bfd_elfNN_bfd_set_private_flags \
  110.   ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true)
  111. #endif
  112. #ifndef bfd_elfNN_bfd_is_local_label
  113. #define bfd_elfNN_bfd_is_local_label bfd_generic_is_local_label
  114. #endif
  115.  
  116. #ifndef bfd_elfNN_get_dynamic_reloc_upper_bound
  117. #define bfd_elfNN_get_dynamic_reloc_upper_bound \
  118.   _bfd_nodynamic_get_dynamic_reloc_upper_bound
  119. #endif
  120. #ifndef bfd_elfNN_canonicalize_dynamic_reloc
  121. #define bfd_elfNN_canonicalize_dynamic_reloc \
  122.   _bfd_nodynamic_canonicalize_dynamic_reloc
  123. #endif
  124.  
  125. #ifdef elf_backend_relocate_section
  126. #ifndef bfd_elfNN_bfd_link_hash_table_create
  127. #define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create
  128. #endif
  129. #else /* ! defined (elf_backend_relocate_section) */
  130. /* If no backend relocate_section routine, use the generic linker.  */
  131. #ifndef bfd_elfNN_bfd_link_hash_table_create
  132. #define bfd_elfNN_bfd_link_hash_table_create \
  133.   _bfd_generic_link_hash_table_create
  134. #endif
  135. #ifndef bfd_elfNN_bfd_link_add_symbols
  136. #define bfd_elfNN_bfd_link_add_symbols    _bfd_generic_link_add_symbols
  137. #endif
  138. #ifndef bfd_elfNN_bfd_final_link
  139. #define bfd_elfNN_bfd_final_link    _bfd_generic_final_link
  140. #endif
  141. #endif /* ! defined (elf_backend_relocate_section) */
  142. #ifndef bfd_elfNN_bfd_link_split_section
  143. #define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section
  144. #endif
  145.  
  146. #ifndef elf_symbol_leading_char
  147. #define elf_symbol_leading_char 0
  148. #endif
  149.  
  150. #ifndef elf_info_to_howto
  151. #define elf_info_to_howto 0
  152. #endif
  153.  
  154. #ifndef elf_info_to_howto_rel
  155. #define elf_info_to_howto_rel 0
  156. #endif
  157.  
  158. #ifndef ELF_MAXPAGESIZE
  159. #define ELF_MAXPAGESIZE 1
  160. #endif
  161.  
  162. #ifndef elf_backend_collect
  163. #define elf_backend_collect false
  164. #endif
  165. #ifndef elf_backend_type_change_ok
  166. #define elf_backend_type_change_ok false
  167. #endif
  168.  
  169. #ifndef elf_backend_sym_is_global
  170. #define elf_backend_sym_is_global    0
  171. #endif
  172. #ifndef elf_backend_object_p
  173. #define elf_backend_object_p        0
  174. #endif
  175. #ifndef elf_backend_symbol_processing
  176. #define elf_backend_symbol_processing    0
  177. #endif
  178. #ifndef elf_backend_symbol_table_processing
  179. #define elf_backend_symbol_table_processing    0
  180. #endif
  181. #ifndef elf_backend_section_processing
  182. #define elf_backend_section_processing    0
  183. #endif
  184. #ifndef elf_backend_section_from_shdr
  185. #define elf_backend_section_from_shdr    0
  186. #endif
  187. #ifndef elf_backend_fake_sections
  188. #define elf_backend_fake_sections    0
  189. #endif
  190. #ifndef elf_backend_section_from_bfd_section
  191. #define elf_backend_section_from_bfd_section    0
  192. #endif
  193. #ifndef elf_backend_add_symbol_hook
  194. #define elf_backend_add_symbol_hook    0
  195. #endif
  196. #ifndef elf_backend_link_output_symbol_hook
  197. #define elf_backend_link_output_symbol_hook 0
  198. #endif
  199. #ifndef elf_backend_create_dynamic_sections
  200. #define elf_backend_create_dynamic_sections 0
  201. #endif
  202. #ifndef elf_backend_check_relocs
  203. #define elf_backend_check_relocs    0
  204. #endif
  205. #ifndef elf_backend_adjust_dynamic_symbol
  206. #define elf_backend_adjust_dynamic_symbol 0
  207. #endif
  208. #ifndef elf_backend_size_dynamic_sections
  209. #define elf_backend_size_dynamic_sections 0
  210. #endif
  211. #ifndef elf_backend_relocate_section
  212. #define elf_backend_relocate_section    0
  213. #endif
  214. #ifndef elf_backend_finish_dynamic_symbol
  215. #define elf_backend_finish_dynamic_symbol    0
  216. #endif
  217. #ifndef elf_backend_finish_dynamic_sections
  218. #define elf_backend_finish_dynamic_sections    0
  219. #endif
  220. #ifndef elf_backend_begin_write_processing
  221. #define elf_backend_begin_write_processing    0
  222. #endif
  223. #ifndef elf_backend_final_write_processing
  224. #define elf_backend_final_write_processing    0
  225. #endif
  226. #ifndef elf_backend_additional_program_headers
  227. #define elf_backend_additional_program_headers    0
  228. #endif
  229. #ifndef elf_backend_modify_segment_map
  230. #define elf_backend_modify_segment_map    0
  231. #endif
  232. #ifndef elf_backend_ecoff_debug_swap
  233. #define elf_backend_ecoff_debug_swap    0
  234. #endif
  235.  
  236. #ifndef ELF_MACHINE_ALT1
  237. #define ELF_MACHINE_ALT1 0
  238. #endif
  239.  
  240. #ifndef ELF_MACHINE_ALT2
  241. #define ELF_MACHINE_ALT2 0
  242. #endif
  243.  
  244. #ifndef elf_backend_size_info
  245. #define elf_backend_size_info _bfd_elfNN_size_info
  246. #endif
  247.  
  248. extern const struct elf_size_info _bfd_elfNN_size_info;
  249.  
  250. static CONST struct elf_backend_data elfNN_bed =
  251. {
  252. #ifdef USE_REL
  253.   0,                /* use_rela_p */
  254. #else
  255.   1,                /* use_rela_p */
  256. #endif
  257.   ELF_ARCH,            /* arch */
  258.   ELF_MACHINE_CODE,        /* elf_machine_code */
  259.   ELF_MAXPAGESIZE,        /* maxpagesize */
  260.   elf_backend_collect,
  261.   elf_backend_type_change_ok,
  262.   elf_info_to_howto,
  263.   elf_info_to_howto_rel,
  264.   elf_backend_sym_is_global,
  265.   elf_backend_object_p,
  266.   elf_backend_symbol_processing,
  267.   elf_backend_symbol_table_processing,
  268.   elf_backend_section_processing,
  269.   elf_backend_section_from_shdr,
  270.   elf_backend_fake_sections,
  271.   elf_backend_section_from_bfd_section,
  272.   elf_backend_add_symbol_hook,
  273.   elf_backend_link_output_symbol_hook,
  274.   elf_backend_create_dynamic_sections,
  275.   elf_backend_check_relocs,
  276.   elf_backend_adjust_dynamic_symbol,
  277.   elf_backend_size_dynamic_sections,
  278.   elf_backend_relocate_section,
  279.   elf_backend_finish_dynamic_symbol,
  280.   elf_backend_finish_dynamic_sections,
  281.   elf_backend_begin_write_processing,
  282.   elf_backend_final_write_processing,
  283.   elf_backend_additional_program_headers,
  284.   elf_backend_modify_segment_map,
  285.   elf_backend_ecoff_debug_swap,
  286.   ELF_MACHINE_ALT1,
  287.   ELF_MACHINE_ALT2,
  288.   &elf_backend_size_info,
  289.   elf_backend_want_got_plt,
  290.   elf_backend_plt_readonly,
  291.   elf_backend_want_plt_sym
  292. };
  293.  
  294. #ifdef TARGET_BIG_SYM
  295. const bfd_target TARGET_BIG_SYM =
  296. {
  297.   /* name: identify kind of target */
  298.   TARGET_BIG_NAME,
  299.  
  300.   /* flavour: general indication about file */
  301.   bfd_target_elf_flavour,
  302.  
  303.   /* byteorder: data is big endian */
  304.   BFD_ENDIAN_BIG,
  305.  
  306.   /* header_byteorder: header is also big endian */
  307.   BFD_ENDIAN_BIG,
  308.  
  309.   /* object_flags: mask of all file flags */
  310.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  311.    DYNAMIC | WP_TEXT | D_PAGED),
  312.   
  313.   /* section_flags: mask of all section flags */
  314.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  315.    SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
  316.  
  317.    /* leading_symbol_char: is the first char of a user symbol
  318.       predictable, and if so what is it */
  319.   elf_symbol_leading_char,
  320.  
  321.   /* ar_pad_char: pad character for filenames within an archive header
  322.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  323.      of the archiver and/or os and should be independently tunable */
  324.   '/',
  325.  
  326.   /* ar_max_namelen: maximum number of characters in an archive header
  327.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  328.      of the archiver and should be independently tunable.  This value is
  329.      a WAG (wild a** guess) */
  330.   14,
  331.  
  332.   /* Routines to byte-swap various sized integers from the data sections */
  333.   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  334.     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  335.     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  336.  
  337.   /* Routines to byte-swap various sized integers from the file headers */
  338.   bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  339.     bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  340.     bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  341.  
  342.   /* bfd_check_format: check the format of a file being read */
  343.   { _bfd_dummy_target,        /* unknown format */
  344.     bfd_elfNN_object_p,        /* assembler/linker output (object file) */
  345.     bfd_generic_archive_p,    /* an archive */
  346.     bfd_elfNN_core_file_p    /* a core file */
  347.   },
  348.  
  349.   /* bfd_set_format: set the format of a file being written */
  350.   { bfd_false,
  351.     bfd_elf_mkobject,
  352.     _bfd_generic_mkarchive,
  353.     bfd_false
  354.   },
  355.  
  356.   /* bfd_write_contents: write cached information into a file being written */
  357.   { bfd_false,
  358.     bfd_elfNN_write_object_contents,
  359.     _bfd_write_archive_contents,
  360.     bfd_false
  361.   },
  362.  
  363.       BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
  364.       BFD_JUMP_TABLE_COPY (bfd_elfNN),
  365.       BFD_JUMP_TABLE_CORE (bfd_elfNN),
  366.       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  367.       BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
  368.       BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
  369.       BFD_JUMP_TABLE_WRITE (bfd_elfNN),
  370.       BFD_JUMP_TABLE_LINK (bfd_elfNN),
  371.       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
  372.  
  373.   /* backend_data: */
  374.   (PTR) &elfNN_bed,
  375. };
  376. #endif
  377.  
  378. #ifdef TARGET_LITTLE_SYM
  379. const bfd_target TARGET_LITTLE_SYM =
  380. {
  381.   /* name: identify kind of target */
  382.   TARGET_LITTLE_NAME,
  383.  
  384.   /* flavour: general indication about file */
  385.   bfd_target_elf_flavour,
  386.  
  387.   /* byteorder: data is little endian */
  388.   BFD_ENDIAN_LITTLE,
  389.  
  390.   /* header_byteorder: header is also little endian */
  391.   BFD_ENDIAN_LITTLE,
  392.  
  393.   /* object_flags: mask of all file flags */
  394.   (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS |
  395.    DYNAMIC | WP_TEXT | D_PAGED),
  396.   
  397.   /* section_flags: mask of all section flags */
  398.   (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY |
  399.    SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES),
  400.  
  401.    /* leading_symbol_char: is the first char of a user symbol
  402.       predictable, and if so what is it */
  403.   elf_symbol_leading_char,
  404.  
  405.   /* ar_pad_char: pad character for filenames within an archive header
  406.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  407.      of the archiver and/or os and should be independently tunable */
  408.   '/',
  409.  
  410.   /* ar_max_namelen: maximum number of characters in an archive header
  411.      FIXME:  this really has nothing to do with ELF, this is a characteristic
  412.      of the archiver and should be independently tunable.  This value is
  413.      a WAG (wild a** guess) */
  414.   14,
  415.  
  416.   /* Routines to byte-swap various sized integers from the data sections */
  417.   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  418.     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  419.     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  420.  
  421.   /* Routines to byte-swap various sized integers from the file headers */
  422.   bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  423.     bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  424.     bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  425.  
  426.   /* bfd_check_format: check the format of a file being read */
  427.   { _bfd_dummy_target,        /* unknown format */
  428.     bfd_elfNN_object_p,        /* assembler/linker output (object file) */
  429.     bfd_generic_archive_p,    /* an archive */
  430.     bfd_elfNN_core_file_p    /* a core file */
  431.   },
  432.  
  433.   /* bfd_set_format: set the format of a file being written */
  434.   { bfd_false,
  435.     bfd_elf_mkobject,
  436.     _bfd_generic_mkarchive,
  437.     bfd_false
  438.   },
  439.  
  440.   /* bfd_write_contents: write cached information into a file being written */
  441.   { bfd_false,
  442.     bfd_elfNN_write_object_contents,
  443.     _bfd_write_archive_contents,
  444.     bfd_false
  445.   },
  446.  
  447.       BFD_JUMP_TABLE_GENERIC (bfd_elfNN),
  448.       BFD_JUMP_TABLE_COPY (bfd_elfNN),
  449.       BFD_JUMP_TABLE_CORE (bfd_elfNN),
  450.       BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff),
  451.       BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN),
  452.       BFD_JUMP_TABLE_RELOCS (bfd_elfNN),
  453.       BFD_JUMP_TABLE_WRITE (bfd_elfNN),
  454.       BFD_JUMP_TABLE_LINK (bfd_elfNN),
  455.       BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN),
  456.  
  457.   /* backend_data: */
  458.   (PTR) &elfNN_bed,
  459. };
  460. #endif
  461.