nlm-target.h 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. /* Target definitions for 32/64-bit NLM (NetWare Loadable Module)
  2. Copyright (C) 1993-2017 Free Software Foundation, Inc.
  3. This file is part of BFD, the Binary File Descriptor library.
  4. This program is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 3 of the License, or
  7. (at your option) any later version.
  8. This program is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. GNU General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with this program; if not, write to the Free Software
  14. Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
  15. MA 02110-1301, USA. */
  16. #define nlm_core_file_p _bfd_dummy_target
  17. #define nlm_get_symtab_upper_bound nlmNAME (get_symtab_upper_bound)
  18. #define nlm_canonicalize_symtab nlmNAME (canonicalize_symtab)
  19. #define nlm_make_empty_symbol nlmNAME (make_empty_symbol)
  20. #define nlm_print_symbol nlmNAME (print_symbol)
  21. #define nlm_get_symbol_info nlmNAME (get_symbol_info)
  22. #define nlm_get_symbol_version_string _bfd_nosymbols_get_symbol_version_string
  23. #define nlm_bfd_is_local_label_name bfd_generic_is_local_label_name
  24. #define nlm_bfd_is_target_special_symbol ((bfd_boolean (*) (bfd *, asymbol *)) bfd_false)
  25. #define nlm_get_lineno _bfd_nosymbols_get_lineno
  26. #define nlm_find_nearest_line _bfd_nosymbols_find_nearest_line
  27. #define nlm_find_line _bfd_nosymbols_find_line
  28. #define nlm_find_inliner_info _bfd_nosymbols_find_inliner_info
  29. #define nlm_bfd_make_debug_symbol _bfd_nosymbols_bfd_make_debug_symbol
  30. #define nlm_read_minisymbols _bfd_generic_read_minisymbols
  31. #define nlm_minisymbol_to_symbol _bfd_generic_minisymbol_to_symbol
  32. #define nlm_get_reloc_upper_bound nlmNAME (get_reloc_upper_bound)
  33. #define nlm_canonicalize_reloc nlmNAME (canonicalize_reloc)
  34. #define nlm_set_reloc _bfd_generic_set_reloc
  35. #define nlm_bfd_reloc_type_lookup bfd_default_reloc_type_lookup
  36. #define nlm_bfd_reloc_name_lookup _bfd_norelocs_bfd_reloc_name_lookup
  37. #define nlm_set_section_contents nlmNAME (set_section_contents)
  38. #define nlm_sizeof_headers _bfd_nolink_sizeof_headers
  39. #define nlm_bfd_get_relocated_section_contents bfd_generic_get_relocated_section_contents
  40. #define nlm_bfd_relax_section bfd_generic_relax_section
  41. #define nlm_bfd_gc_sections bfd_generic_gc_sections
  42. #define nlm_bfd_lookup_section_flags bfd_generic_lookup_section_flags
  43. #define nlm_bfd_merge_sections bfd_generic_merge_sections
  44. #define nlm_bfd_is_group_section bfd_generic_is_group_section
  45. #define nlm_bfd_discard_group bfd_generic_discard_group
  46. #define nlm_section_already_linked _bfd_generic_section_already_linked
  47. #define nlm_bfd_define_common_symbol bfd_generic_define_common_symbol
  48. #define nlm_bfd_define_start_stop bfd_generic_define_start_stop
  49. #define nlm_bfd_link_hash_table_create _bfd_generic_link_hash_table_create
  50. #define nlm_bfd_link_add_symbols _bfd_generic_link_add_symbols
  51. #define nlm_bfd_link_just_syms _bfd_generic_link_just_syms
  52. #define nlm_bfd_copy_link_hash_symbol_type \
  53. _bfd_generic_copy_link_hash_symbol_type
  54. #define nlm_bfd_final_link _bfd_generic_final_link
  55. #define nlm_bfd_link_split_section _bfd_generic_link_split_section
  56. #define nlm_bfd_link_check_relocs _bfd_generic_link_check_relocs
  57. /* This structure contains everything that BFD knows about a target.
  58. It includes things like its byte order, name, what routines to call
  59. to do various operations, etc. Every BFD points to a target structure
  60. with its "xvec" member.
  61. There are two such structures here: one for big-endian machines and
  62. one for little-endian machines. */
  63. /* Forward declaration for use when initialising alternative_target field. */
  64. #ifdef TARGET_LITTLE_SYM
  65. extern const bfd_target TARGET_LITTLE_SYM;
  66. #endif
  67. #ifdef TARGET_BIG_SYM
  68. const bfd_target TARGET_BIG_SYM =
  69. {
  70. /* Name: identify kind of target. */
  71. TARGET_BIG_NAME,
  72. /* Flavour: general indication about file. */
  73. bfd_target_nlm_flavour,
  74. /* Byteorder: data is big endian. */
  75. BFD_ENDIAN_BIG,
  76. /* Header_byteorder: header is also big endian. */
  77. BFD_ENDIAN_BIG,
  78. /* Object_flags: mask of all file flags. */
  79. (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
  80. | WP_TEXT),
  81. /* Section_flags: mask of all section flags. */
  82. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
  83. | SEC_CODE | SEC_DATA),
  84. /* Leading_symbol_char: is the first char of a user symbol
  85. predictable, and if so what is it. */
  86. 0,
  87. /* AR_pad_char: pad character for filenames within an archive header
  88. FIXME: this really has nothing to do with NLM, this is a characteristic
  89. of the archiver and/or os and should be independently tunable. */
  90. '/',
  91. /* AR_max_namelen: maximum number of characters in an archive header
  92. FIXME: this really has nothing to do with NLM, this is a characteristic
  93. of the archiver and should be independently tunable. This value is
  94. a WAG (wild a** guess). */
  95. 15,
  96. 0, /* match priority. */
  97. /* Routines to byte-swap various sized integers from the data sections. */
  98. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  99. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  100. bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  101. /* Routines to byte-swap various sized integers from the file headers. */
  102. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  103. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  104. bfd_getb16, bfd_getb_signed_16, bfd_putb16,
  105. /* bfd_check_format: check the format of a file being read. */
  106. { _bfd_dummy_target, /* Unknown format. */
  107. nlmNAME (object_p), /* Assembler/linker output (object file). */
  108. bfd_generic_archive_p, /* An archive. */
  109. nlm_core_file_p /* A core file. */
  110. },
  111. /* bfd_set_format: set the format of a file being written. */
  112. { bfd_false,
  113. nlm_mkobject,
  114. _bfd_generic_mkarchive,
  115. bfd_false
  116. },
  117. /* bfd_write_contents: write cached information into a file being written. */
  118. { bfd_false,
  119. nlmNAME (write_object_contents),
  120. _bfd_write_archive_contents,
  121. bfd_false
  122. },
  123. /* Initialize a jump table with the standard macro.
  124. All names start with "nlm". */
  125. BFD_JUMP_TABLE_GENERIC (_bfd_generic),
  126. BFD_JUMP_TABLE_COPY (_bfd_generic),
  127. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  128. BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
  129. BFD_JUMP_TABLE_SYMBOLS (nlm),
  130. BFD_JUMP_TABLE_RELOCS (nlm),
  131. BFD_JUMP_TABLE_WRITE (nlm),
  132. BFD_JUMP_TABLE_LINK (nlm),
  133. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  134. /* Alternative endian target. */
  135. #ifdef TARGET_LITTLE_SYM
  136. & TARGET_LITTLE_SYM,
  137. #else
  138. NULL,
  139. #endif
  140. /* Backend_data. */
  141. (void *) TARGET_BACKEND_DATA
  142. };
  143. #endif
  144. #ifdef TARGET_LITTLE_SYM
  145. const bfd_target TARGET_LITTLE_SYM =
  146. {
  147. /* Name: identify kind of target. */
  148. TARGET_LITTLE_NAME,
  149. /* Flavour: general indication about file. */
  150. bfd_target_nlm_flavour,
  151. /* Byteorder: data is little endian. */
  152. BFD_ENDIAN_LITTLE,
  153. /* Header_byteorder: header is also little endian. */
  154. BFD_ENDIAN_LITTLE,
  155. /* Object_flags: mask of all file flags. */
  156. (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS
  157. | WP_TEXT),
  158. /* Section_flags: mask of all section flags. */
  159. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY
  160. | SEC_DATA),
  161. /* Leading_symbol_char: is the first char of a user symbol
  162. predictable, and if so what is it. */
  163. 0,
  164. /* AR_pad_char: pad character for filenames within an archive header
  165. FIXME: this really has nothing to do with NLM, this is a characteristic
  166. of the archiver and/or os and should be independently tunable. */
  167. '/',
  168. /* AR_max_namelen: maximum number of characters in an archive header
  169. FIXME: this really has nothing to do with NLM, this is a characteristic
  170. of the archiver and should be independently tunable. This value is
  171. a WAG (wild a** guess). */
  172. 15,
  173. 0, /* match priority. */
  174. /* Routines to byte-swap various sized integers from the data sections. */
  175. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  176. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  177. bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  178. /* Routines to byte-swap various sized integers from the file headers. */
  179. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  180. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  181. bfd_getl16, bfd_getl_signed_16, bfd_putl16,
  182. /* bfd_check_format: check the format of a file being read. */
  183. { _bfd_dummy_target, /* Unknown format. */
  184. nlmNAME(object_p), /* Assembler/linker output (object file). */
  185. bfd_generic_archive_p, /* An archive. */
  186. nlm_core_file_p /* A core file. */
  187. },
  188. /* bfd_set_format: set the format of a file being written. */
  189. { bfd_false,
  190. nlm_mkobject,
  191. _bfd_generic_mkarchive,
  192. bfd_false
  193. },
  194. /* bfd_write_contents: write cached information into a file being written. */
  195. { bfd_false,
  196. nlmNAME(write_object_contents),
  197. _bfd_write_archive_contents,
  198. bfd_false
  199. },
  200. /* Initialize a jump table with the standard macro.
  201. All names start with "nlm". */
  202. BFD_JUMP_TABLE_GENERIC (_bfd_generic),
  203. BFD_JUMP_TABLE_COPY (_bfd_generic),
  204. BFD_JUMP_TABLE_CORE (_bfd_nocore),
  205. BFD_JUMP_TABLE_ARCHIVE (_bfd_noarchive),
  206. BFD_JUMP_TABLE_SYMBOLS (nlm),
  207. BFD_JUMP_TABLE_RELOCS (nlm),
  208. BFD_JUMP_TABLE_WRITE (nlm),
  209. BFD_JUMP_TABLE_LINK (nlm),
  210. BFD_JUMP_TABLE_DYNAMIC (_bfd_nodynamic),
  211. /* Alternative endian target. */
  212. #ifdef TARGET_BIG_SYM
  213. & TARGET_BIG_SYM,
  214. #else
  215. NULL,
  216. #endif
  217. /* Backend_data. */
  218. (void *) TARGET_BACKEND_DATA
  219. };
  220. #endif