elfxx-target.h revision 38889
1/* Target definitions for NN-bit ELF 2 Copyright 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc. 3 4This file is part of BFD, the Binary File Descriptor library. 5 6This program is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2 of the License, or 9(at your option) any later version. 10 11This program is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with this program; if not, write to the Free Software 18Foundation, 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_elf_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_got_symbol_offset 65#define elf_backend_got_symbol_offset (bfd_vma) 0 66#endif 67#ifndef elf_backend_want_got_plt 68#define elf_backend_want_got_plt 0 69#endif 70#ifndef elf_backend_plt_readonly 71#define elf_backend_plt_readonly 0 72#endif 73#ifndef elf_backend_want_plt_sym 74#define elf_backend_want_plt_sym 0 75#endif 76#ifndef elf_backend_plt_not_loaded 77#define elf_backend_plt_not_loaded 0 78#endif 79#ifndef elf_backend_plt_alignment 80#define elf_backend_plt_alignment 2 81#endif 82 83#define bfd_elfNN_bfd_debug_info_start bfd_void 84#define bfd_elfNN_bfd_debug_info_end bfd_void 85#define bfd_elfNN_bfd_debug_info_accumulate (PROTO(void,(*),(bfd*, struct sec *))) bfd_void 86 87#ifndef bfd_elfNN_bfd_get_relocated_section_contents 88#define bfd_elfNN_bfd_get_relocated_section_contents \ 89 bfd_generic_get_relocated_section_contents 90#endif 91 92#ifndef bfd_elfNN_bfd_relax_section 93#define bfd_elfNN_bfd_relax_section bfd_generic_relax_section 94#endif 95 96#define bfd_elfNN_bfd_make_debug_symbol \ 97 ((asymbol *(*) PARAMS ((bfd *, void *, unsigned long))) bfd_nullvoidptr) 98 99#ifndef bfd_elfNN_bfd_copy_private_symbol_data 100#define bfd_elfNN_bfd_copy_private_symbol_data \ 101 _bfd_elf_copy_private_symbol_data 102#endif 103 104#ifndef bfd_elfNN_bfd_copy_private_section_data 105#define bfd_elfNN_bfd_copy_private_section_data \ 106 _bfd_elf_copy_private_section_data 107#endif 108#ifndef bfd_elfNN_bfd_copy_private_bfd_data 109#define bfd_elfNN_bfd_copy_private_bfd_data \ 110 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) 111#endif 112#ifndef bfd_elfNN_bfd_print_private_bfd_data 113#define bfd_elfNN_bfd_print_private_bfd_data \ 114 _bfd_elf_print_private_bfd_data 115#endif 116#ifndef bfd_elfNN_bfd_merge_private_bfd_data 117#define bfd_elfNN_bfd_merge_private_bfd_data \ 118 ((boolean (*) PARAMS ((bfd *, bfd *))) bfd_true) 119#endif 120#ifndef bfd_elfNN_bfd_set_private_flags 121#define bfd_elfNN_bfd_set_private_flags \ 122 ((boolean (*) PARAMS ((bfd *, flagword))) bfd_true) 123#endif 124#ifndef bfd_elfNN_bfd_is_local_label_name 125#define bfd_elfNN_bfd_is_local_label_name _bfd_elf_is_local_label_name 126#endif 127 128#ifndef bfd_elfNN_get_dynamic_reloc_upper_bound 129#define bfd_elfNN_get_dynamic_reloc_upper_bound \ 130 _bfd_elf_get_dynamic_reloc_upper_bound 131#endif 132#ifndef bfd_elfNN_canonicalize_dynamic_reloc 133#define bfd_elfNN_canonicalize_dynamic_reloc \ 134 _bfd_elf_canonicalize_dynamic_reloc 135#endif 136 137#ifdef elf_backend_relocate_section 138#ifndef bfd_elfNN_bfd_link_hash_table_create 139#define bfd_elfNN_bfd_link_hash_table_create _bfd_elf_link_hash_table_create 140#endif 141#else /* ! defined (elf_backend_relocate_section) */ 142/* If no backend relocate_section routine, use the generic linker. */ 143#ifndef bfd_elfNN_bfd_link_hash_table_create 144#define bfd_elfNN_bfd_link_hash_table_create \ 145 _bfd_generic_link_hash_table_create 146#endif 147#ifndef bfd_elfNN_bfd_link_add_symbols 148#define bfd_elfNN_bfd_link_add_symbols _bfd_generic_link_add_symbols 149#endif 150#ifndef bfd_elfNN_bfd_final_link 151#define bfd_elfNN_bfd_final_link _bfd_generic_final_link 152#endif 153#endif /* ! defined (elf_backend_relocate_section) */ 154#ifndef bfd_elfNN_bfd_link_split_section 155#define bfd_elfNN_bfd_link_split_section _bfd_generic_link_split_section 156#endif 157 158#ifndef bfd_elfNN_archive_p 159#define bfd_elfNN_archive_p bfd_generic_archive_p 160#endif 161 162#ifndef bfd_elfNN_write_archive_contents 163#define bfd_elfNN_write_archive_contents _bfd_write_archive_contents 164#endif 165 166#ifndef bfd_elfNN_mkobject 167#define bfd_elfNN_mkobject bfd_elf_mkobject 168#endif 169 170#ifndef bfd_elfNN_mkarchive 171#define bfd_elfNN_mkarchive _bfd_generic_mkarchive 172#endif 173 174#ifndef elf_symbol_leading_char 175#define elf_symbol_leading_char 0 176#endif 177 178#ifndef elf_info_to_howto 179#define elf_info_to_howto 0 180#endif 181 182#ifndef elf_info_to_howto_rel 183#define elf_info_to_howto_rel 0 184#endif 185 186#ifndef ELF_MAXPAGESIZE 187#define ELF_MAXPAGESIZE 1 188#endif 189 190#ifndef elf_backend_collect 191#define elf_backend_collect false 192#endif 193#ifndef elf_backend_type_change_ok 194#define elf_backend_type_change_ok false 195#endif 196 197#ifndef elf_backend_sym_is_global 198#define elf_backend_sym_is_global 0 199#endif 200#ifndef elf_backend_object_p 201#define elf_backend_object_p 0 202#endif 203#ifndef elf_backend_symbol_processing 204#define elf_backend_symbol_processing 0 205#endif 206#ifndef elf_backend_symbol_table_processing 207#define elf_backend_symbol_table_processing 0 208#endif 209#ifndef elf_backend_section_processing 210#define elf_backend_section_processing 0 211#endif 212#ifndef elf_backend_section_from_shdr 213#define elf_backend_section_from_shdr 0 214#endif 215#ifndef elf_backend_fake_sections 216#define elf_backend_fake_sections 0 217#endif 218#ifndef elf_backend_section_from_bfd_section 219#define elf_backend_section_from_bfd_section 0 220#endif 221#ifndef elf_backend_add_symbol_hook 222#define elf_backend_add_symbol_hook 0 223#endif 224#ifndef elf_backend_link_output_symbol_hook 225#define elf_backend_link_output_symbol_hook 0 226#endif 227#ifndef elf_backend_create_dynamic_sections 228#define elf_backend_create_dynamic_sections 0 229#endif 230#ifndef elf_backend_check_relocs 231#define elf_backend_check_relocs 0 232#endif 233#ifndef elf_backend_adjust_dynamic_symbol 234#define elf_backend_adjust_dynamic_symbol 0 235#endif 236#ifndef elf_backend_always_size_sections 237#define elf_backend_always_size_sections 0 238#endif 239#ifndef elf_backend_size_dynamic_sections 240#define elf_backend_size_dynamic_sections 0 241#endif 242#ifndef elf_backend_relocate_section 243#define elf_backend_relocate_section 0 244#endif 245#ifndef elf_backend_finish_dynamic_symbol 246#define elf_backend_finish_dynamic_symbol 0 247#endif 248#ifndef elf_backend_finish_dynamic_sections 249#define elf_backend_finish_dynamic_sections 0 250#endif 251#ifndef elf_backend_begin_write_processing 252#define elf_backend_begin_write_processing 0 253#endif 254#ifndef elf_backend_final_write_processing 255#define elf_backend_final_write_processing 0 256#endif 257#ifndef elf_backend_additional_program_headers 258#define elf_backend_additional_program_headers 0 259#endif 260#ifndef elf_backend_modify_segment_map 261#define elf_backend_modify_segment_map 0 262#endif 263#ifndef elf_backend_ecoff_debug_swap 264#define elf_backend_ecoff_debug_swap 0 265#endif 266 267#ifndef ELF_MACHINE_ALT1 268#define ELF_MACHINE_ALT1 0 269#endif 270 271#ifndef ELF_MACHINE_ALT2 272#define ELF_MACHINE_ALT2 0 273#endif 274 275#ifndef elf_backend_size_info 276#define elf_backend_size_info _bfd_elfNN_size_info 277#endif 278 279extern const struct elf_size_info _bfd_elfNN_size_info; 280 281static CONST struct elf_backend_data elfNN_bed = 282{ 283#ifdef USE_REL 284 0, /* use_rela_p */ 285#else 286 1, /* use_rela_p */ 287#endif 288 ELF_ARCH, /* arch */ 289 ELF_MACHINE_CODE, /* elf_machine_code */ 290 ELF_MAXPAGESIZE, /* maxpagesize */ 291 elf_backend_collect, 292 elf_backend_type_change_ok, 293 elf_info_to_howto, 294 elf_info_to_howto_rel, 295 elf_backend_sym_is_global, 296 elf_backend_object_p, 297 elf_backend_symbol_processing, 298 elf_backend_symbol_table_processing, 299 elf_backend_section_processing, 300 elf_backend_section_from_shdr, 301 elf_backend_fake_sections, 302 elf_backend_section_from_bfd_section, 303 elf_backend_add_symbol_hook, 304 elf_backend_link_output_symbol_hook, 305 elf_backend_create_dynamic_sections, 306 elf_backend_check_relocs, 307 elf_backend_adjust_dynamic_symbol, 308 elf_backend_always_size_sections, 309 elf_backend_size_dynamic_sections, 310 elf_backend_relocate_section, 311 elf_backend_finish_dynamic_symbol, 312 elf_backend_finish_dynamic_sections, 313 elf_backend_begin_write_processing, 314 elf_backend_final_write_processing, 315 elf_backend_additional_program_headers, 316 elf_backend_modify_segment_map, 317 elf_backend_ecoff_debug_swap, 318 ELF_MACHINE_ALT1, 319 ELF_MACHINE_ALT2, 320 &elf_backend_size_info, 321 elf_backend_got_symbol_offset, 322 elf_backend_want_got_plt, 323 elf_backend_plt_readonly, 324 elf_backend_want_plt_sym, 325 elf_backend_plt_not_loaded, 326 elf_backend_plt_alignment 327}; 328 329#ifdef TARGET_BIG_SYM 330const bfd_target TARGET_BIG_SYM = 331{ 332 /* name: identify kind of target */ 333 TARGET_BIG_NAME, 334 335 /* flavour: general indication about file */ 336 bfd_target_elf_flavour, 337 338 /* byteorder: data is big endian */ 339 BFD_ENDIAN_BIG, 340 341 /* header_byteorder: header is also big endian */ 342 BFD_ENDIAN_BIG, 343 344 /* object_flags: mask of all file flags */ 345 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | 346 DYNAMIC | WP_TEXT | D_PAGED), 347 348 /* section_flags: mask of all section flags */ 349 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | 350 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), 351 352 /* leading_symbol_char: is the first char of a user symbol 353 predictable, and if so what is it */ 354 elf_symbol_leading_char, 355 356 /* ar_pad_char: pad character for filenames within an archive header 357 FIXME: this really has nothing to do with ELF, this is a characteristic 358 of the archiver and/or os and should be independently tunable */ 359 '/', 360 361 /* ar_max_namelen: maximum number of characters in an archive header 362 FIXME: this really has nothing to do with ELF, this is a characteristic 363 of the archiver and should be independently tunable. This value is 364 a WAG (wild a** guess) */ 365 14, 366 367 /* Routines to byte-swap various sized integers from the data sections */ 368 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 369 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 370 bfd_getb16, bfd_getb_signed_16, bfd_putb16, 371 372 /* Routines to byte-swap various sized integers from the file headers */ 373 bfd_getb64, bfd_getb_signed_64, bfd_putb64, 374 bfd_getb32, bfd_getb_signed_32, bfd_putb32, 375 bfd_getb16, bfd_getb_signed_16, bfd_putb16, 376 377 /* bfd_check_format: check the format of a file being read */ 378 { _bfd_dummy_target, /* unknown format */ 379 bfd_elfNN_object_p, /* assembler/linker output (object file) */ 380 bfd_elfNN_archive_p, /* an archive */ 381 bfd_elfNN_core_file_p /* a core file */ 382 }, 383 384 /* bfd_set_format: set the format of a file being written */ 385 { bfd_false, 386 bfd_elfNN_mkobject, 387 bfd_elfNN_mkarchive, 388 bfd_false 389 }, 390 391 /* bfd_write_contents: write cached information into a file being written */ 392 { bfd_false, 393 bfd_elfNN_write_object_contents, 394 bfd_elfNN_write_archive_contents, 395 bfd_false 396 }, 397 398 BFD_JUMP_TABLE_GENERIC (bfd_elfNN), 399 BFD_JUMP_TABLE_COPY (bfd_elfNN), 400 BFD_JUMP_TABLE_CORE (bfd_elfNN), 401#ifdef bfd_elfNN_archive_functions 402 BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive), 403#else 404 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 405#endif 406 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN), 407 BFD_JUMP_TABLE_RELOCS (bfd_elfNN), 408 BFD_JUMP_TABLE_WRITE (bfd_elfNN), 409 BFD_JUMP_TABLE_LINK (bfd_elfNN), 410 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN), 411 412 /* backend_data: */ 413 (PTR) &elfNN_bed, 414}; 415#endif 416 417#ifdef TARGET_LITTLE_SYM 418const bfd_target TARGET_LITTLE_SYM = 419{ 420 /* name: identify kind of target */ 421 TARGET_LITTLE_NAME, 422 423 /* flavour: general indication about file */ 424 bfd_target_elf_flavour, 425 426 /* byteorder: data is little endian */ 427 BFD_ENDIAN_LITTLE, 428 429 /* header_byteorder: header is also little endian */ 430 BFD_ENDIAN_LITTLE, 431 432 /* object_flags: mask of all file flags */ 433 (HAS_RELOC | EXEC_P | HAS_LINENO | HAS_DEBUG | HAS_SYMS | HAS_LOCALS | 434 DYNAMIC | WP_TEXT | D_PAGED), 435 436 /* section_flags: mask of all section flags */ 437 (SEC_HAS_CONTENTS | SEC_ALLOC | SEC_LOAD | SEC_RELOC | SEC_READONLY | 438 SEC_CODE | SEC_DATA | SEC_DEBUGGING | SEC_EXCLUDE | SEC_SORT_ENTRIES), 439 440 /* leading_symbol_char: is the first char of a user symbol 441 predictable, and if so what is it */ 442 elf_symbol_leading_char, 443 444 /* ar_pad_char: pad character for filenames within an archive header 445 FIXME: this really has nothing to do with ELF, this is a characteristic 446 of the archiver and/or os and should be independently tunable */ 447 '/', 448 449 /* ar_max_namelen: maximum number of characters in an archive header 450 FIXME: this really has nothing to do with ELF, this is a characteristic 451 of the archiver and should be independently tunable. This value is 452 a WAG (wild a** guess) */ 453 14, 454 455 /* Routines to byte-swap various sized integers from the data sections */ 456 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 457 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 458 bfd_getl16, bfd_getl_signed_16, bfd_putl16, 459 460 /* Routines to byte-swap various sized integers from the file headers */ 461 bfd_getl64, bfd_getl_signed_64, bfd_putl64, 462 bfd_getl32, bfd_getl_signed_32, bfd_putl32, 463 bfd_getl16, bfd_getl_signed_16, bfd_putl16, 464 465 /* bfd_check_format: check the format of a file being read */ 466 { _bfd_dummy_target, /* unknown format */ 467 bfd_elfNN_object_p, /* assembler/linker output (object file) */ 468 bfd_elfNN_archive_p, /* an archive */ 469 bfd_elfNN_core_file_p /* a core file */ 470 }, 471 472 /* bfd_set_format: set the format of a file being written */ 473 { bfd_false, 474 bfd_elfNN_mkobject, 475 bfd_elfNN_mkarchive, 476 bfd_false 477 }, 478 479 /* bfd_write_contents: write cached information into a file being written */ 480 { bfd_false, 481 bfd_elfNN_write_object_contents, 482 bfd_elfNN_write_archive_contents, 483 bfd_false 484 }, 485 486 BFD_JUMP_TABLE_GENERIC (bfd_elfNN), 487 BFD_JUMP_TABLE_COPY (bfd_elfNN), 488 BFD_JUMP_TABLE_CORE (bfd_elfNN), 489#ifdef bfd_elfNN_archive_functions 490 BFD_JUMP_TABLE_ARCHIVE (bfd_elfNN_archive), 491#else 492 BFD_JUMP_TABLE_ARCHIVE (_bfd_archive_coff), 493#endif 494 BFD_JUMP_TABLE_SYMBOLS (bfd_elfNN), 495 BFD_JUMP_TABLE_RELOCS (bfd_elfNN), 496 BFD_JUMP_TABLE_WRITE (bfd_elfNN), 497 BFD_JUMP_TABLE_LINK (bfd_elfNN), 498 BFD_JUMP_TABLE_DYNAMIC (bfd_elfNN), 499 500 /* backend_data: */ 501 (PTR) &elfNN_bed, 502}; 503#endif 504