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