aout-target.h 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713
  1. /* Define a target vector and some small routines for a variant of a.out.
  2. Copyright (C) 1990-2022 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. #include "aout/aout64.h"
  17. #include "aout/stab_gnu.h"
  18. #include "aout/ar.h"
  19. /*#include "libaout.h"*/
  20. #ifndef SEGMENT_SIZE
  21. #define SEGMENT_SIZE TARGET_PAGE_SIZE
  22. #endif
  23. extern reloc_howto_type * NAME (aout, reloc_type_lookup) (bfd *, bfd_reloc_code_real_type);
  24. extern reloc_howto_type * NAME (aout, reloc_name_lookup) (bfd *, const char *);
  25. /* Set parameters about this a.out file that are machine-dependent.
  26. This routine is called from some_aout_object_p just before it returns. */
  27. #ifndef MY_callback
  28. static bfd_cleanup
  29. MY (callback) (bfd *abfd)
  30. {
  31. struct internal_exec *execp = exec_hdr (abfd);
  32. unsigned int arch_align_power;
  33. unsigned long arch_align;
  34. /* Calculate the file positions of the parts of a newly read aout header. */
  35. obj_textsec (abfd)->size = N_TXTSIZE (execp);
  36. /* The virtual memory addresses of the sections. */
  37. obj_textsec (abfd)->vma = N_TXTADDR (execp);
  38. obj_datasec (abfd)->vma = N_DATADDR (execp);
  39. obj_bsssec (abfd)->vma = N_BSSADDR (execp);
  40. /* For some targets, if the entry point is not in the same page
  41. as the start of the text, then adjust the VMA so that it is.
  42. FIXME: Do this with a macro like SET_ARCH_MACH instead? */
  43. if (aout_backend_info (abfd)->entry_is_text_address
  44. && execp->a_entry > obj_textsec (abfd)->vma)
  45. {
  46. bfd_vma adjust;
  47. adjust = execp->a_entry - obj_textsec (abfd)->vma;
  48. /* Adjust only by whole pages. */
  49. adjust &= ~(TARGET_PAGE_SIZE - 1);
  50. obj_textsec (abfd)->vma += adjust;
  51. obj_datasec (abfd)->vma += adjust;
  52. obj_bsssec (abfd)->vma += adjust;
  53. }
  54. /* Set the load addresses to be the same as the virtual addresses. */
  55. obj_textsec (abfd)->lma = obj_textsec (abfd)->vma;
  56. obj_datasec (abfd)->lma = obj_datasec (abfd)->vma;
  57. obj_bsssec (abfd)->lma = obj_bsssec (abfd)->vma;
  58. /* The file offsets of the sections. */
  59. obj_textsec (abfd)->filepos = N_TXTOFF (execp);
  60. obj_datasec (abfd)->filepos = N_DATOFF (execp);
  61. /* The file offsets of the relocation info. */
  62. obj_textsec (abfd)->rel_filepos = N_TRELOFF (execp);
  63. obj_datasec (abfd)->rel_filepos = N_DRELOFF (execp);
  64. /* The file offsets of the string table and symbol table. */
  65. obj_sym_filepos (abfd) = N_SYMOFF (execp);
  66. obj_str_filepos (abfd) = N_STROFF (execp);
  67. /* Determine the architecture and machine type of the object file. */
  68. #ifdef SET_ARCH_MACH
  69. SET_ARCH_MACH (abfd, execp);
  70. #else
  71. bfd_default_set_arch_mach (abfd, DEFAULT_ARCH, 0);
  72. #endif
  73. /* The number of relocation records. This must be called after
  74. SET_ARCH_MACH. It assumes that SET_ARCH_MACH will set
  75. obj_reloc_entry_size correctly, if the reloc size is not
  76. RELOC_STD_SIZE. */
  77. obj_textsec (abfd)->reloc_count =
  78. execp->a_trsize / obj_reloc_entry_size (abfd);
  79. obj_datasec (abfd)->reloc_count =
  80. execp->a_drsize / obj_reloc_entry_size (abfd);
  81. /* Now that we know the architecture, set the alignments of the
  82. sections. This is normally done by NAME (aout,new_section_hook),
  83. but when the initial sections were created the architecture had
  84. not yet been set. However, for backward compatibility, we don't
  85. set the alignment power any higher than as required by the size
  86. of the section. */
  87. arch_align_power = bfd_get_arch_info (abfd)->section_align_power;
  88. arch_align = 1 << arch_align_power;
  89. if ((BFD_ALIGN (obj_textsec (abfd)->size, arch_align)
  90. == obj_textsec (abfd)->size)
  91. && (BFD_ALIGN (obj_datasec (abfd)->size, arch_align)
  92. == obj_datasec (abfd)->size)
  93. && (BFD_ALIGN (obj_bsssec (abfd)->size, arch_align)
  94. == obj_bsssec (abfd)->size))
  95. {
  96. obj_textsec (abfd)->alignment_power = arch_align_power;
  97. obj_datasec (abfd)->alignment_power = arch_align_power;
  98. obj_bsssec (abfd)->alignment_power = arch_align_power;
  99. }
  100. /* Don't set sizes now -- can't be sure until we know arch & mach.
  101. Sizes get set in set_sizes callback, later. */
  102. return _bfd_no_cleanup;
  103. }
  104. #endif
  105. #ifndef MY_object_p
  106. /* Finish up the reading of an a.out file header. */
  107. static bfd_cleanup
  108. MY (object_p) (bfd *abfd)
  109. {
  110. struct external_exec exec_bytes; /* Raw exec header from file. */
  111. struct internal_exec exec; /* Cleaned-up exec header. */
  112. bfd_cleanup cleanup;
  113. size_t amt = EXEC_BYTES_SIZE;
  114. if (bfd_bread ((void *) &exec_bytes, amt, abfd) != amt)
  115. {
  116. if (bfd_get_error () != bfd_error_system_call)
  117. bfd_set_error (bfd_error_wrong_format);
  118. return 0;
  119. }
  120. #ifdef SWAP_MAGIC
  121. exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
  122. #else
  123. exec.a_info = GET_MAGIC (abfd, exec_bytes.e_info);
  124. #endif
  125. if (N_BADMAG (&exec))
  126. return 0;
  127. #ifdef MACHTYPE_OK
  128. if (!(MACHTYPE_OK (N_MACHTYPE (&exec))))
  129. return 0;
  130. #endif
  131. NAME (aout, swap_exec_header_in) (abfd, &exec_bytes, &exec);
  132. #ifdef SWAP_MAGIC
  133. /* Swap_exec_header_in read in a_info with the wrong byte order. */
  134. exec.a_info = SWAP_MAGIC (exec_bytes.e_info);
  135. #endif
  136. cleanup = NAME (aout, some_aout_object_p) (abfd, &exec, MY (callback));
  137. #ifdef ENTRY_CAN_BE_ZERO
  138. /* The NEWSOS3 entry-point is/was 0, which (amongst other lossage)
  139. means that it isn't obvious if EXEC_P should be set.
  140. All of the following must be true for an executable:
  141. There must be no relocations, the bfd can be neither an
  142. archive nor an archive element, and the file must be executable. */
  143. if (exec.a_trsize + exec.a_drsize == 0
  144. && bfd_get_format(abfd) == bfd_object && abfd->my_archive == NULL)
  145. {
  146. struct stat buf;
  147. #ifndef S_IXUSR
  148. #define S_IXUSR 0100 /* Execute by owner. */
  149. #endif
  150. if (stat (bfd_get_filename (abfd), &buf) == 0
  151. && (buf.st_mode & S_IXUSR) != 0)
  152. abfd->flags |= EXEC_P;
  153. }
  154. #endif /* ENTRY_CAN_BE_ZERO */
  155. return cleanup;
  156. }
  157. #define MY_object_p MY (object_p)
  158. #endif
  159. #ifndef MY_mkobject
  160. static bool
  161. MY (mkobject) (bfd *abfd)
  162. {
  163. return NAME (aout, mkobject (abfd));
  164. }
  165. #define MY_mkobject MY (mkobject)
  166. #endif
  167. #ifndef MY_bfd_copy_private_section_data
  168. /* Copy private section data. This actually does nothing with the
  169. sections. It copies the subformat field. We copy it here, because
  170. we need to know whether this is a QMAGIC file before we set the
  171. section contents, and copy_private_bfd_data is not called until
  172. after the section contents have been set. */
  173. static bool
  174. MY_bfd_copy_private_section_data (bfd *ibfd,
  175. asection *isec ATTRIBUTE_UNUSED,
  176. bfd *obfd,
  177. asection *osec ATTRIBUTE_UNUSED)
  178. {
  179. if (bfd_get_flavour (ibfd) == bfd_target_aout_flavour
  180. && bfd_get_flavour (obfd) == bfd_target_aout_flavour)
  181. obj_aout_subformat (obfd) = obj_aout_subformat (ibfd);
  182. return true;
  183. }
  184. #endif
  185. /* Write an object file.
  186. Section contents have already been written. We write the
  187. file header, symbols, and relocation. */
  188. #ifndef MY_write_object_contents
  189. static bool
  190. MY (write_object_contents) (bfd *abfd)
  191. {
  192. struct external_exec exec_bytes;
  193. struct internal_exec *execp = exec_hdr (abfd);
  194. obj_reloc_entry_size (abfd) = RELOC_STD_SIZE;
  195. WRITE_HEADERS (abfd, execp);
  196. return true;
  197. }
  198. #define MY_write_object_contents MY (write_object_contents)
  199. #endif
  200. #ifndef MY_set_sizes
  201. static bool
  202. MY (set_sizes) (bfd *abfd)
  203. {
  204. adata(abfd).page_size = TARGET_PAGE_SIZE;
  205. adata(abfd).segment_size = SEGMENT_SIZE;
  206. #ifdef ZMAGIC_DISK_BLOCK_SIZE
  207. adata(abfd).zmagic_disk_block_size = ZMAGIC_DISK_BLOCK_SIZE;
  208. #else
  209. adata(abfd).zmagic_disk_block_size = TARGET_PAGE_SIZE;
  210. #endif
  211. adata(abfd).exec_bytes_size = EXEC_BYTES_SIZE;
  212. return true;
  213. }
  214. #define MY_set_sizes MY (set_sizes)
  215. #endif
  216. #ifndef MY_exec_hdr_flags
  217. #define MY_exec_hdr_flags 0
  218. #endif
  219. #ifndef MY_backend_data
  220. #ifndef MY_zmagic_contiguous
  221. #define MY_zmagic_contiguous 0
  222. #endif
  223. #ifndef MY_text_includes_header
  224. #define MY_text_includes_header 0
  225. #endif
  226. #ifndef MY_entry_is_text_address
  227. #define MY_entry_is_text_address 0
  228. #endif
  229. #ifndef MY_exec_header_not_counted
  230. #define MY_exec_header_not_counted 0
  231. #endif
  232. #ifndef MY_add_dynamic_symbols
  233. #define MY_add_dynamic_symbols 0
  234. #endif
  235. #ifndef MY_add_one_symbol
  236. #define MY_add_one_symbol 0
  237. #endif
  238. #ifndef MY_link_dynamic_object
  239. #define MY_link_dynamic_object 0
  240. #endif
  241. #ifndef MY_write_dynamic_symbol
  242. #define MY_write_dynamic_symbol 0
  243. #endif
  244. #ifndef MY_check_dynamic_reloc
  245. #define MY_check_dynamic_reloc 0
  246. #endif
  247. #ifndef MY_finish_dynamic_link
  248. #define MY_finish_dynamic_link 0
  249. #endif
  250. static const struct aout_backend_data MY (backend_data) =
  251. {
  252. MY_zmagic_contiguous,
  253. MY_text_includes_header,
  254. MY_entry_is_text_address,
  255. MY_exec_hdr_flags,
  256. 0, /* Text vma? */
  257. MY_set_sizes,
  258. MY_exec_header_not_counted,
  259. MY_add_dynamic_symbols,
  260. MY_add_one_symbol,
  261. MY_link_dynamic_object,
  262. MY_write_dynamic_symbol,
  263. MY_check_dynamic_reloc,
  264. MY_finish_dynamic_link
  265. };
  266. #define MY_backend_data &MY (backend_data)
  267. #endif
  268. #ifndef MY_final_link_callback
  269. /* Callback for the final_link routine to set the section offsets. */
  270. static void
  271. MY_final_link_callback (bfd *abfd,
  272. file_ptr *ptreloff,
  273. file_ptr *pdreloff,
  274. file_ptr *psymoff)
  275. {
  276. struct internal_exec *execp = exec_hdr (abfd);
  277. *ptreloff = N_TRELOFF (execp);
  278. *pdreloff = N_DRELOFF (execp);
  279. *psymoff = N_SYMOFF (execp);
  280. }
  281. #endif
  282. #ifndef MY_bfd_final_link
  283. /* Final link routine. We need to use a call back to get the correct
  284. offsets in the output file. */
  285. static bool
  286. MY_bfd_final_link (bfd *abfd, struct bfd_link_info *info)
  287. {
  288. return NAME (aout, final_link) (abfd, info, MY_final_link_callback);
  289. }
  290. #endif
  291. /* We assume BFD generic archive files. */
  292. #ifndef MY_openr_next_archived_file
  293. #define MY_openr_next_archived_file bfd_generic_openr_next_archived_file
  294. #endif
  295. #ifndef MY_get_elt_at_index
  296. #define MY_get_elt_at_index _bfd_generic_get_elt_at_index
  297. #endif
  298. #ifndef MY_generic_stat_arch_elt
  299. #define MY_generic_stat_arch_elt bfd_generic_stat_arch_elt
  300. #endif
  301. #ifndef MY_slurp_armap
  302. #define MY_slurp_armap bfd_slurp_bsd_armap
  303. #endif
  304. #ifndef MY_slurp_extended_name_table
  305. #define MY_slurp_extended_name_table _bfd_slurp_extended_name_table
  306. #endif
  307. #ifndef MY_construct_extended_name_table
  308. #define MY_construct_extended_name_table \
  309. _bfd_archive_bsd_construct_extended_name_table
  310. #endif
  311. #ifndef MY_write_armap
  312. #define MY_write_armap _bfd_bsd_write_armap
  313. #endif
  314. #ifndef MY_read_ar_hdr
  315. #define MY_read_ar_hdr _bfd_generic_read_ar_hdr
  316. #endif
  317. #ifndef MY_write_ar_hdr
  318. #define MY_write_ar_hdr _bfd_generic_write_ar_hdr
  319. #endif
  320. #ifndef MY_truncate_arname
  321. #define MY_truncate_arname bfd_bsd_truncate_arname
  322. #endif
  323. #ifndef MY_update_armap_timestamp
  324. #define MY_update_armap_timestamp _bfd_archive_bsd_update_armap_timestamp
  325. #endif
  326. /* No core file defined here -- configure in trad-core.c separately. */
  327. #ifndef MY_core_file_failing_command
  328. #define MY_core_file_failing_command _bfd_nocore_core_file_failing_command
  329. #endif
  330. #ifndef MY_core_file_failing_signal
  331. #define MY_core_file_failing_signal _bfd_nocore_core_file_failing_signal
  332. #endif
  333. #ifndef MY_core_file_matches_executable_p
  334. #define MY_core_file_matches_executable_p \
  335. _bfd_nocore_core_file_matches_executable_p
  336. #endif
  337. #ifndef MY_core_file_pid
  338. #define MY_core_file_pid _bfd_nocore_core_file_pid
  339. #endif
  340. #ifndef MY_core_file_p
  341. #define MY_core_file_p _bfd_dummy_target
  342. #endif
  343. #ifndef MY_bfd_debug_info_start
  344. #define MY_bfd_debug_info_start _bfd_void_bfd
  345. #endif
  346. #ifndef MY_bfd_debug_info_end
  347. #define MY_bfd_debug_info_end _bfd_void_bfd
  348. #endif
  349. #ifndef MY_bfd_debug_info_accumulate
  350. #define MY_bfd_debug_info_accumulate _bfd_void_bfd_asection
  351. #endif
  352. #ifndef MY_core_file_failing_command
  353. #define MY_core_file_failing_command NAME (aout, core_file_failing_command)
  354. #endif
  355. #ifndef MY_core_file_failing_signal
  356. #define MY_core_file_failing_signal NAME (aout, core_file_failing_signal)
  357. #endif
  358. #ifndef MY_core_file_matches_executable_p
  359. #define MY_core_file_matches_executable_p NAME (aout, core_file_matches_executable_p)
  360. #endif
  361. #ifndef MY_set_section_contents
  362. #define MY_set_section_contents NAME (aout, set_section_contents)
  363. #endif
  364. #ifndef MY_get_section_contents
  365. #define MY_get_section_contents NAME (aout, get_section_contents)
  366. #endif
  367. #ifndef MY_get_section_contents_in_window
  368. #define MY_get_section_contents_in_window _bfd_generic_get_section_contents_in_window
  369. #endif
  370. #ifndef MY_new_section_hook
  371. #define MY_new_section_hook NAME (aout, new_section_hook)
  372. #endif
  373. #ifndef MY_get_symtab_upper_bound
  374. #define MY_get_symtab_upper_bound NAME (aout, get_symtab_upper_bound)
  375. #endif
  376. #ifndef MY_canonicalize_symtab
  377. #define MY_canonicalize_symtab NAME (aout, canonicalize_symtab)
  378. #endif
  379. #ifndef MY_get_reloc_upper_bound
  380. #define MY_get_reloc_upper_bound NAME (aout,get_reloc_upper_bound)
  381. #endif
  382. #ifndef MY_canonicalize_reloc
  383. #define MY_canonicalize_reloc NAME (aout, canonicalize_reloc)
  384. #endif
  385. #ifndef MY_set_reloc
  386. #define MY_set_reloc _bfd_generic_set_reloc
  387. #endif
  388. #ifndef MY_make_empty_symbol
  389. #define MY_make_empty_symbol NAME (aout, make_empty_symbol)
  390. #endif
  391. #ifndef MY_print_symbol
  392. #define MY_print_symbol NAME (aout, print_symbol)
  393. #endif
  394. #ifndef MY_get_symbol_info
  395. #define MY_get_symbol_info NAME (aout, get_symbol_info)
  396. #endif
  397. #ifndef MY_get_symbol_version_string
  398. #define MY_get_symbol_version_string \
  399. _bfd_nosymbols_get_symbol_version_string
  400. #endif
  401. #ifndef MY_get_lineno
  402. #define MY_get_lineno NAME (aout, get_lineno)
  403. #endif
  404. #ifndef MY_set_arch_mach
  405. #define MY_set_arch_mach NAME (aout, set_arch_mach)
  406. #endif
  407. #ifndef MY_find_nearest_line
  408. #define MY_find_nearest_line NAME (aout, find_nearest_line)
  409. #endif
  410. #ifndef MY_find_line
  411. #define MY_find_line _bfd_nosymbols_find_line
  412. #endif
  413. #ifndef MY_find_inliner_info
  414. #define MY_find_inliner_info _bfd_nosymbols_find_inliner_info
  415. #endif
  416. #ifndef MY_sizeof_headers
  417. #define MY_sizeof_headers NAME (aout, sizeof_headers)
  418. #endif
  419. #ifndef MY_bfd_get_relocated_section_contents
  420. #define MY_bfd_get_relocated_section_contents \
  421. bfd_generic_get_relocated_section_contents
  422. #endif
  423. #ifndef MY_bfd_relax_section
  424. #define MY_bfd_relax_section bfd_generic_relax_section
  425. #endif
  426. #ifndef MY_bfd_gc_sections
  427. #define MY_bfd_gc_sections bfd_generic_gc_sections
  428. #endif
  429. #ifndef MY_bfd_lookup_section_flags
  430. #define MY_bfd_lookup_section_flags bfd_generic_lookup_section_flags
  431. #endif
  432. #ifndef MY_bfd_merge_sections
  433. #define MY_bfd_merge_sections bfd_generic_merge_sections
  434. #endif
  435. #ifndef MY_bfd_is_group_section
  436. #define MY_bfd_is_group_section bfd_generic_is_group_section
  437. #endif
  438. #ifndef MY_bfd_group_name
  439. #define MY_bfd_group_name bfd_generic_group_name
  440. #endif
  441. #ifndef MY_bfd_discard_group
  442. #define MY_bfd_discard_group bfd_generic_discard_group
  443. #endif
  444. #ifndef MY_section_already_linked
  445. #define MY_section_already_linked \
  446. _bfd_generic_section_already_linked
  447. #endif
  448. #ifndef MY_bfd_define_common_symbol
  449. #define MY_bfd_define_common_symbol bfd_generic_define_common_symbol
  450. #endif
  451. #ifndef MY_bfd_link_hide_symbol
  452. #define MY_bfd_link_hide_symbol _bfd_generic_link_hide_symbol
  453. #endif
  454. #ifndef MY_bfd_define_start_stop
  455. #define MY_bfd_define_start_stop bfd_generic_define_start_stop
  456. #endif
  457. #ifndef MY_bfd_reloc_type_lookup
  458. #define MY_bfd_reloc_type_lookup NAME (aout, reloc_type_lookup)
  459. #endif
  460. #ifndef MY_bfd_reloc_name_lookup
  461. #define MY_bfd_reloc_name_lookup NAME (aout, reloc_name_lookup)
  462. #endif
  463. #ifndef MY_bfd_make_debug_symbol
  464. #define MY_bfd_make_debug_symbol 0
  465. #endif
  466. #ifndef MY_read_minisymbols
  467. #define MY_read_minisymbols NAME (aout, read_minisymbols)
  468. #endif
  469. #ifndef MY_minisymbol_to_symbol
  470. #define MY_minisymbol_to_symbol NAME (aout, minisymbol_to_symbol)
  471. #endif
  472. #ifndef MY_bfd_link_hash_table_create
  473. #define MY_bfd_link_hash_table_create NAME (aout, link_hash_table_create)
  474. #endif
  475. #ifndef MY_bfd_link_add_symbols
  476. #define MY_bfd_link_add_symbols NAME (aout, link_add_symbols)
  477. #endif
  478. #ifndef MY_bfd_link_just_syms
  479. #define MY_bfd_link_just_syms _bfd_generic_link_just_syms
  480. #endif
  481. #ifndef MY_bfd_copy_link_hash_symbol_type
  482. #define MY_bfd_copy_link_hash_symbol_type \
  483. _bfd_generic_copy_link_hash_symbol_type
  484. #endif
  485. #ifndef MY_bfd_link_split_section
  486. #define MY_bfd_link_split_section _bfd_generic_link_split_section
  487. #endif
  488. #ifndef MY_bfd_link_check_relocs
  489. #define MY_bfd_link_check_relocs _bfd_generic_link_check_relocs
  490. #endif
  491. #ifndef MY_bfd_copy_private_bfd_data
  492. #define MY_bfd_copy_private_bfd_data _bfd_generic_bfd_copy_private_bfd_data
  493. #endif
  494. #ifndef MY_bfd_merge_private_bfd_data
  495. #define MY_bfd_merge_private_bfd_data _bfd_generic_bfd_merge_private_bfd_data
  496. #endif
  497. #ifndef MY_bfd_copy_private_symbol_data
  498. #define MY_bfd_copy_private_symbol_data _bfd_generic_bfd_copy_private_symbol_data
  499. #endif
  500. #ifndef MY_bfd_copy_private_header_data
  501. #define MY_bfd_copy_private_header_data _bfd_generic_bfd_copy_private_header_data
  502. #endif
  503. #ifndef MY_bfd_print_private_bfd_data
  504. #define MY_bfd_print_private_bfd_data _bfd_generic_bfd_print_private_bfd_data
  505. #endif
  506. #ifndef MY_bfd_set_private_flags
  507. #define MY_bfd_set_private_flags _bfd_generic_bfd_set_private_flags
  508. #endif
  509. #ifndef MY_bfd_is_local_label_name
  510. #define MY_bfd_is_local_label_name bfd_generic_is_local_label_name
  511. #endif
  512. #ifndef MY_bfd_is_target_special_symbol
  513. #define MY_bfd_is_target_special_symbol _bfd_bool_bfd_asymbol_false
  514. #endif
  515. #ifndef MY_bfd_free_cached_info
  516. #define MY_bfd_free_cached_info NAME (aout, bfd_free_cached_info)
  517. #endif
  518. #ifndef MY_close_and_cleanup
  519. /* Handle closing of a BFD including the resource-releasing parts. */
  520. static bool
  521. MY_close_and_cleanup (bfd *abfd)
  522. {
  523. if (!MY_bfd_free_cached_info (abfd))
  524. return false;
  525. return _bfd_generic_close_and_cleanup (abfd);
  526. }
  527. #endif
  528. #ifndef MY_get_dynamic_symtab_upper_bound
  529. #define MY_get_dynamic_symtab_upper_bound \
  530. _bfd_nodynamic_get_dynamic_symtab_upper_bound
  531. #endif
  532. #ifndef MY_canonicalize_dynamic_symtab
  533. #define MY_canonicalize_dynamic_symtab \
  534. _bfd_nodynamic_canonicalize_dynamic_symtab
  535. #endif
  536. #ifndef MY_get_synthetic_symtab
  537. #define MY_get_synthetic_symtab \
  538. _bfd_nodynamic_get_synthetic_symtab
  539. #endif
  540. #ifndef MY_get_dynamic_reloc_upper_bound
  541. #define MY_get_dynamic_reloc_upper_bound \
  542. _bfd_nodynamic_get_dynamic_reloc_upper_bound
  543. #endif
  544. #ifndef MY_canonicalize_dynamic_reloc
  545. #define MY_canonicalize_dynamic_reloc \
  546. _bfd_nodynamic_canonicalize_dynamic_reloc
  547. #endif
  548. /* Aout symbols normally have leading underscores. */
  549. #ifndef MY_symbol_leading_char
  550. #define MY_symbol_leading_char '_'
  551. #endif
  552. /* Aout archives normally use spaces for padding. */
  553. #ifndef AR_PAD_CHAR
  554. #define AR_PAD_CHAR ' '
  555. #endif
  556. #ifndef MY_BFD_TARGET
  557. const bfd_target MY (vec) =
  558. {
  559. TARGETNAME, /* Name. */
  560. bfd_target_aout_flavour,
  561. #ifdef TARGET_IS_BIG_ENDIAN_P
  562. BFD_ENDIAN_BIG, /* Target byte order (big). */
  563. BFD_ENDIAN_BIG, /* Target headers byte order (big). */
  564. #else
  565. BFD_ENDIAN_LITTLE, /* Target byte order (little). */
  566. BFD_ENDIAN_LITTLE, /* Target headers byte order (little). */
  567. #endif
  568. (HAS_RELOC | EXEC_P | /* Object flags. */
  569. HAS_LINENO | HAS_DEBUG |
  570. HAS_SYMS | HAS_LOCALS | DYNAMIC | WP_TEXT | D_PAGED),
  571. (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_CODE | SEC_DATA),
  572. MY_symbol_leading_char,
  573. AR_PAD_CHAR, /* AR_pad_char. */
  574. 15, /* AR_max_namelen. */
  575. 0, /* match priority. */
  576. TARGET_KEEP_UNUSED_SECTION_SYMBOLS, /* keep unused section symbols. */
  577. #ifdef TARGET_IS_BIG_ENDIAN_P
  578. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  579. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  580. bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Data. */
  581. bfd_getb64, bfd_getb_signed_64, bfd_putb64,
  582. bfd_getb32, bfd_getb_signed_32, bfd_putb32,
  583. bfd_getb16, bfd_getb_signed_16, bfd_putb16, /* Headers. */
  584. #else
  585. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  586. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  587. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Data. */
  588. bfd_getl64, bfd_getl_signed_64, bfd_putl64,
  589. bfd_getl32, bfd_getl_signed_32, bfd_putl32,
  590. bfd_getl16, bfd_getl_signed_16, bfd_putl16, /* Headers. */
  591. #endif
  592. { /* bfd_check_format. */
  593. _bfd_dummy_target,
  594. MY_object_p,
  595. bfd_generic_archive_p,
  596. MY_core_file_p
  597. },
  598. { /* bfd_set_format. */
  599. _bfd_bool_bfd_false_error,
  600. MY_mkobject,
  601. _bfd_generic_mkarchive,
  602. _bfd_bool_bfd_false_error
  603. },
  604. { /* bfd_write_contents. */
  605. _bfd_bool_bfd_false_error,
  606. MY_write_object_contents,
  607. _bfd_write_archive_contents,
  608. _bfd_bool_bfd_false_error
  609. },
  610. BFD_JUMP_TABLE_GENERIC (MY),
  611. BFD_JUMP_TABLE_COPY (MY),
  612. BFD_JUMP_TABLE_CORE (MY),
  613. BFD_JUMP_TABLE_ARCHIVE (MY),
  614. BFD_JUMP_TABLE_SYMBOLS (MY),
  615. BFD_JUMP_TABLE_RELOCS (MY),
  616. BFD_JUMP_TABLE_WRITE (MY),
  617. BFD_JUMP_TABLE_LINK (MY),
  618. BFD_JUMP_TABLE_DYNAMIC (MY),
  619. /* Alternative_target. */
  620. NULL,
  621. MY_backend_data
  622. };
  623. #endif /* MY_BFD_TARGET */