| OLD | NEW |
| 1 /* Motorola 68HC12-specific support for 32-bit ELF | 1 /* Motorola 68HC12-specific support for 32-bit ELF |
| 2 Copyright 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007 | 2 Copyright 1999, 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2010, 2012 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 Contributed by Stephane Carrez (stcarrez@nerim.fr) | 4 Contributed by Stephane Carrez (stcarrez@nerim.fr) |
| 5 (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) | 5 (Heavily copied from the D10V port by Martin Hunt (hunt@cygnus.com)) |
| 6 | 6 |
| 7 This file is part of BFD, the Binary File Descriptor library. | 7 This file is part of BFD, the Binary File Descriptor library. |
| 8 | 8 |
| 9 This program is free software; you can redistribute it and/or modify | 9 This program is free software; you can redistribute it and/or modify |
| 10 it under the terms of the GNU General Public License as published by | 10 it under the terms of the GNU General Public License as published by |
| 11 the Free Software Foundation; either version 3 of the License, or | 11 the Free Software Foundation; either version 3 of the License, or |
| 12 (at your option) any later version. | 12 (at your option) any later version. |
| (...skipping 17 matching lines...) Expand all Loading... |
| 30 #include "elf/m68hc11.h" | 30 #include "elf/m68hc11.h" |
| 31 #include "opcode/m68hc11.h" | 31 #include "opcode/m68hc11.h" |
| 32 | 32 |
| 33 /* Relocation functions. */ | 33 /* Relocation functions. */ |
| 34 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup | 34 static reloc_howto_type *bfd_elf32_bfd_reloc_type_lookup |
| 35 (bfd *, bfd_reloc_code_real_type); | 35 (bfd *, bfd_reloc_code_real_type); |
| 36 static void m68hc11_info_to_howto_rel | 36 static void m68hc11_info_to_howto_rel |
| 37 (bfd *, arelent *, Elf_Internal_Rela *); | 37 (bfd *, arelent *, Elf_Internal_Rela *); |
| 38 | 38 |
| 39 /* Trampoline generation. */ | 39 /* Trampoline generation. */ |
| 40 static bfd_boolean m68hc12_elf_size_one_stub | |
| 41 (struct bfd_hash_entry *gen_entry, void *in_arg); | |
| 42 static bfd_boolean m68hc12_elf_build_one_stub | |
| 43 (struct bfd_hash_entry *gen_entry, void *in_arg); | |
| 44 static struct bfd_link_hash_table* m68hc12_elf_bfd_link_hash_table_create | |
| 45 (bfd*); | |
| 46 | 40 |
| 47 static bfd_boolean m68hc12_elf_set_mach_from_flags PARAMS ((bfd *)); | |
| 48 | 41 |
| 49 /* Use REL instead of RELA to save space */ | 42 /* Use REL instead of RELA to save space */ |
| 50 #define USE_REL 1 | 43 #define USE_REL 1 |
| 51 | 44 |
| 52 /* The 68HC12 microcontroler has a memory bank switching system | 45 /* The 68HC12 microcontroler has a memory bank switching system |
| 53 with a 16Kb window in the 64Kb address space. The extended memory | 46 with a 16Kb window in the 64Kb address space. The extended memory |
| 54 is mapped in the 16Kb window (at 0x8000). The page register controls | 47 is mapped in the 16Kb window (at 0x8000). The page register controls |
| 55 which 16Kb bank is mapped. The call/rtc instructions take care of | 48 which 16Kb bank is mapped. The call/rtc instructions take care of |
| 56 bank switching in function calls/returns. | 49 bank switching in function calls/returns. |
| 57 | 50 |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 317 0, /* bitpos */ | 310 0, /* bitpos */ |
| 318 complain_overflow_dont, /* complain_on_overflow */ | 311 complain_overflow_dont, /* complain_on_overflow */ |
| 319 m68hc11_elf_special_reloc,/* special_function */ | 312 m68hc11_elf_special_reloc,/* special_function */ |
| 320 "R_M68HC12_PAGE", /* name */ | 313 "R_M68HC12_PAGE", /* name */ |
| 321 FALSE, /* partial_inplace */ | 314 FALSE, /* partial_inplace */ |
| 322 0x00ff, /* src_mask */ | 315 0x00ff, /* src_mask */ |
| 323 0x00ff, /* dst_mask */ | 316 0x00ff, /* dst_mask */ |
| 324 FALSE), /* pcrel_offset */ | 317 FALSE), /* pcrel_offset */ |
| 325 | 318 |
| 326 EMPTY_HOWTO (14), | 319 EMPTY_HOWTO (14), |
| 327 EMPTY_HOWTO (15), | 320 |
| 328 EMPTY_HOWTO (16), | 321 /* A 16 bit absolute relocation. */ |
| 329 EMPTY_HOWTO (17), | 322 HOWTO (R_M68HC12_16B,»» /* type */ |
| 330 EMPTY_HOWTO (18), | 323 » 0,» » » /* rightshift */ |
| 331 EMPTY_HOWTO (19), | 324 » 1,» » » /* size (0 = byte, 1 = short, 2 = long) */ |
| 325 » 16,» » » /* bitsize */ |
| 326 » FALSE,»» » /* pc_relative */ |
| 327 » 0,» » » /* bitpos */ |
| 328 » complain_overflow_bitfield,» /* complain_on_overflow */ |
| 329 » bfd_elf_generic_reloc,»/* special_function */ |
| 330 » "R_M68HC12_16B",» /* name */ |
| 331 » FALSE,»» » /* partial_inplace */ |
| 332 » 0xffff,» » » /* src_mask */ |
| 333 » 0xffff,» » » /* dst_mask */ |
| 334 » FALSE),» » /* pcrel_offset */ |
| 335 |
| 336 /* A 9 bit PC-rel relocation. */ |
| 337 HOWTO (R_M68HC12_PCREL_9,» /* type */ |
| 338 » 1,» » » /* rightshift */ |
| 339 » 1,» » » /* size (0 = byte, 1 = short, 2 = long) */ |
| 340 » 10,» » » /* bitsize (result is >>1) */ |
| 341 » TRUE,» » » /* pc_relative */ |
| 342 » 0,» » » /* bitpos */ |
| 343 » complain_overflow_dont,» /* complain_on_overflow */ |
| 344 » bfd_elf_generic_reloc,»/* special_function */ |
| 345 » "R_M68HC12_PCREL_9",» /* name */ |
| 346 » TRUE,» » » /* partial_inplace */ |
| 347 » 0xfe00,» » /* src_mask */ |
| 348 » 0x01ff,» » /* dst_mask */ |
| 349 » TRUE), /* pcrel_offset */ |
| 350 |
| 351 /* A 10 bit PC-rel relocation. */ |
| 352 HOWTO (R_M68HC12_PCREL_10,» /* type */ |
| 353 » 1,» » » /* rightshift */ |
| 354 » 1,» » » /* size (0 = byte, 1 = short, 2 = long) */ |
| 355 » 11,» » » /* bitsize (result is >>1) */ |
| 356 » TRUE,» » » /* pc_relative */ |
| 357 » 0,» » » /* bitpos */ |
| 358 » complain_overflow_dont,» /* complain_on_overflow */ |
| 359 » bfd_elf_generic_reloc,»/* special_function */ |
| 360 » "R_M68HC12_PCREL_10",» /* name */ |
| 361 » TRUE,» » » /* partial_inplace */ |
| 362 » 0xfc00,» » /* src_mask */ |
| 363 » 0x03ff,» » /* dst_mask */ |
| 364 » TRUE), /* pcrel_offset */ |
| 365 |
| 366 /* A 8 bit absolute relocation (upper address). */ |
| 367 HOWTO (R_M68HC12_HI8XG,» » /* type */ |
| 368 » 8,» » » /* rightshift */ |
| 369 » 0,» » » /* size (0 = byte, 1 = short, 2 = long) */ |
| 370 » 8,» » » /* bitsize */ |
| 371 » FALSE,»» » /* pc_relative */ |
| 372 » 0,» » » /* bitpos */ |
| 373 » complain_overflow_bitfield,» /* complain_on_overflow */ |
| 374 » bfd_elf_generic_reloc,»/* special_function */ |
| 375 » "R_M68HC12_HI8XG",» /* name */ |
| 376 » FALSE,»» » /* partial_inplace */ |
| 377 » 0x00ff,» » /* src_mask */ |
| 378 » 0x00ff,» » /* dst_mask */ |
| 379 » FALSE),» » /* pcrel_offset */ |
| 380 |
| 381 /* A 8 bit absolute relocation (lower address). */ |
| 382 HOWTO (R_M68HC12_LO8XG,» » /* type */ |
| 383 » 8,» » » /* rightshift */ |
| 384 » 0,» » » /* size (0 = byte, 1 = short, 2 = long) */ |
| 385 » 8,» » » /* bitsize */ |
| 386 » FALSE,»» » /* pc_relative */ |
| 387 » 0,» » » /* bitpos */ |
| 388 » complain_overflow_bitfield,» /* complain_on_overflow */ |
| 389 » bfd_elf_generic_reloc,»/* special_function */ |
| 390 » "R_M68HC12_LO8XG",» /* name */ |
| 391 » FALSE,»» » /* partial_inplace */ |
| 392 » 0x00ff,» » /* src_mask */ |
| 393 » 0x00ff,» » /* dst_mask */ |
| 394 » FALSE),» » /* pcrel_offset */ |
| 332 | 395 |
| 333 /* Mark beginning of a jump instruction (any form). */ | 396 /* Mark beginning of a jump instruction (any form). */ |
| 334 HOWTO (R_M68HC11_RL_JUMP, /* type */ | 397 HOWTO (R_M68HC11_RL_JUMP, /* type */ |
| 335 0, /* rightshift */ | 398 0, /* rightshift */ |
| 336 1, /* size (0 = byte, 1 = short, 2 = long) */ | 399 1, /* size (0 = byte, 1 = short, 2 = long) */ |
| 337 0, /* bitsize */ | 400 0, /* bitsize */ |
| 338 FALSE, /* pc_relative */ | 401 FALSE, /* pc_relative */ |
| 339 0, /* bitpos */ | 402 0, /* bitpos */ |
| 340 complain_overflow_dont, /* complain_on_overflow */ | 403 complain_overflow_dont, /* complain_on_overflow */ |
| 341 m68hc11_elf_ignore_reloc, /* special_function */ | 404 m68hc11_elf_ignore_reloc, /* special_function */ |
| (...skipping 20 matching lines...) Expand all Loading... |
| 362 }; | 425 }; |
| 363 | 426 |
| 364 /* Map BFD reloc types to M68HC11 ELF reloc types. */ | 427 /* Map BFD reloc types to M68HC11 ELF reloc types. */ |
| 365 | 428 |
| 366 struct m68hc11_reloc_map | 429 struct m68hc11_reloc_map |
| 367 { | 430 { |
| 368 bfd_reloc_code_real_type bfd_reloc_val; | 431 bfd_reloc_code_real_type bfd_reloc_val; |
| 369 unsigned char elf_reloc_val; | 432 unsigned char elf_reloc_val; |
| 370 }; | 433 }; |
| 371 | 434 |
| 372 static const struct m68hc11_reloc_map m68hc11_reloc_map[] = { | 435 static const struct m68hc11_reloc_map m68hc11_reloc_map[] = |
| 436 { |
| 373 {BFD_RELOC_NONE, R_M68HC11_NONE,}, | 437 {BFD_RELOC_NONE, R_M68HC11_NONE,}, |
| 374 {BFD_RELOC_8, R_M68HC11_8}, | 438 {BFD_RELOC_8, R_M68HC11_8}, |
| 375 {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8}, | 439 {BFD_RELOC_M68HC11_HI8, R_M68HC11_HI8}, |
| 376 {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8}, | 440 {BFD_RELOC_M68HC11_LO8, R_M68HC11_LO8}, |
| 377 {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8}, | 441 {BFD_RELOC_8_PCREL, R_M68HC11_PCREL_8}, |
| 378 {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16}, | 442 {BFD_RELOC_16_PCREL, R_M68HC11_PCREL_16}, |
| 379 {BFD_RELOC_16, R_M68HC11_16}, | 443 {BFD_RELOC_16, R_M68HC11_16}, |
| 380 {BFD_RELOC_32, R_M68HC11_32}, | 444 {BFD_RELOC_32, R_M68HC11_32}, |
| 381 {BFD_RELOC_M68HC11_3B, R_M68HC11_3B}, | 445 {BFD_RELOC_M68HC11_3B, R_M68HC11_3B}, |
| 382 | 446 |
| 383 {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT}, | 447 {BFD_RELOC_VTABLE_INHERIT, R_M68HC11_GNU_VTINHERIT}, |
| 384 {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY}, | 448 {BFD_RELOC_VTABLE_ENTRY, R_M68HC11_GNU_VTENTRY}, |
| 385 | 449 |
| 386 {BFD_RELOC_M68HC11_LO16, R_M68HC11_LO16}, | 450 {BFD_RELOC_M68HC11_LO16, R_M68HC11_LO16}, |
| 387 {BFD_RELOC_M68HC11_PAGE, R_M68HC11_PAGE}, | 451 {BFD_RELOC_M68HC11_PAGE, R_M68HC11_PAGE}, |
| 388 {BFD_RELOC_M68HC11_24, R_M68HC11_24}, | 452 {BFD_RELOC_M68HC11_24, R_M68HC11_24}, |
| 389 | 453 |
| 390 {BFD_RELOC_M68HC11_RL_JUMP, R_M68HC11_RL_JUMP}, | 454 {BFD_RELOC_M68HC11_RL_JUMP, R_M68HC11_RL_JUMP}, |
| 391 {BFD_RELOC_M68HC11_RL_GROUP, R_M68HC11_RL_GROUP}, | 455 {BFD_RELOC_M68HC11_RL_GROUP, R_M68HC11_RL_GROUP}, |
| 456 |
| 457 {BFD_RELOC_M68HC12_16B, R_M68HC12_16B}, |
| 458 |
| 459 {BFD_RELOC_M68HC12_9_PCREL, R_M68HC12_PCREL_9}, |
| 460 {BFD_RELOC_M68HC12_10_PCREL, R_M68HC12_PCREL_10}, |
| 461 {BFD_RELOC_M68HC12_HI8XG, R_M68HC12_HI8XG}, |
| 462 {BFD_RELOC_M68HC12_LO8XG, R_M68HC12_LO8XG}, |
| 392 }; | 463 }; |
| 393 | 464 |
| 394 static reloc_howto_type * | 465 static reloc_howto_type * |
| 395 bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, | 466 bfd_elf32_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
| 396 bfd_reloc_code_real_type code) | 467 bfd_reloc_code_real_type code) |
| 397 { | 468 { |
| 398 unsigned int i; | 469 unsigned int i; |
| 399 | 470 |
| 400 for (i = 0; | 471 for (i = 0; |
| 401 i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map); | 472 i < sizeof (m68hc11_reloc_map) / sizeof (struct m68hc11_reloc_map); |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 571 #define ELF_MACHINE_CODE EM_68HC12 | 642 #define ELF_MACHINE_CODE EM_68HC12 |
| 572 #define ELF_MAXPAGESIZE 0x1000 | 643 #define ELF_MAXPAGESIZE 0x1000 |
| 573 | 644 |
| 574 #define TARGET_BIG_SYM bfd_elf32_m68hc12_vec | 645 #define TARGET_BIG_SYM bfd_elf32_m68hc12_vec |
| 575 #define TARGET_BIG_NAME "elf32-m68hc12" | 646 #define TARGET_BIG_NAME "elf32-m68hc12" |
| 576 | 647 |
| 577 #define elf_info_to_howto 0 | 648 #define elf_info_to_howto 0 |
| 578 #define elf_info_to_howto_rel m68hc11_info_to_howto_rel | 649 #define elf_info_to_howto_rel m68hc11_info_to_howto_rel |
| 579 #define elf_backend_check_relocs elf32_m68hc11_check_relocs | 650 #define elf_backend_check_relocs elf32_m68hc11_check_relocs |
| 580 #define elf_backend_relocate_section elf32_m68hc11_relocate_section | 651 #define elf_backend_relocate_section elf32_m68hc11_relocate_section |
error: old chunk mismatch |
None
| OLD | NEW |