OLD | NEW |
1 /* Motorola 68k series support for 32-bit ELF | 1 /* Motorola 68k series support for 32-bit ELF |
2 Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, | 2 Copyright 1993, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, |
3 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 | 3 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 |
4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
5 | 5 |
6 This file is part of BFD, the Binary File Descriptor library. | 6 This file is part of BFD, the Binary File Descriptor library. |
7 | 7 |
8 This program is free software; you can redistribute it and/or modify | 8 This program is free software; you can redistribute it and/or modify |
9 it under the terms of the GNU General Public License as published by | 9 it under the terms of the GNU General Public License as published by |
10 the Free Software Foundation; either version 3 of the License, or | 10 the Free Software Foundation; either version 3 of the License, or |
11 (at your option) any later version. | 11 (at your option) any later version. |
12 | 12 |
13 This program is distributed in the hope that it will be useful, | 13 This program is distributed in the hope that it will be useful, |
14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 GNU General Public License for more details. | 16 GNU General Public License for more details. |
17 | 17 |
18 You should have received a copy of the GNU General Public License | 18 You should have received a copy of the GNU General Public License |
19 along with this program; if not, write to the Free Software | 19 along with this program; if not, write to the Free Software |
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
21 MA 02110-1301, USA. */ | 21 MA 02110-1301, USA. */ |
22 | 22 |
23 #include "sysdep.h" | 23 #include "sysdep.h" |
24 #include "bfd.h" | 24 #include "bfd.h" |
25 #include "bfdlink.h" | 25 #include "bfdlink.h" |
26 #include "libbfd.h" | 26 #include "libbfd.h" |
27 #include "elf-bfd.h" | 27 #include "elf-bfd.h" |
28 #include "elf/m68k.h" | 28 #include "elf/m68k.h" |
29 #include "opcode/m68k.h" | 29 #include "opcode/m68k.h" |
30 | 30 |
31 static reloc_howto_type *reloc_type_lookup | 31 static bfd_boolean |
32 PARAMS ((bfd *, bfd_reloc_code_real_type)); | 32 elf_m68k_discard_copies (struct elf_link_hash_entry *, void *); |
33 static void rtype_to_howto | |
34 PARAMS ((bfd *, arelent *, Elf_Internal_Rela *)); | |
35 static struct bfd_hash_entry *elf_m68k_link_hash_newfunc | |
36 PARAMS ((struct bfd_hash_entry *, struct bfd_hash_table *, const char *)); | |
37 static struct bfd_link_hash_table *elf_m68k_link_hash_table_create | |
38 PARAMS ((bfd *)); | |
39 static bfd_boolean elf_m68k_check_relocs | |
40 PARAMS ((bfd *, struct bfd_link_info *, asection *, | |
41 » const Elf_Internal_Rela *)); | |
42 static bfd_boolean elf_m68k_adjust_dynamic_symbol | |
43 PARAMS ((struct bfd_link_info *, struct elf_link_hash_entry *)); | |
44 static bfd_boolean elf_m68k_size_dynamic_sections | |
45 PARAMS ((bfd *, struct bfd_link_info *)); | |
46 static bfd_boolean elf_m68k_discard_copies | |
47 PARAMS ((struct elf_link_hash_entry *, PTR)); | |
48 static bfd_boolean elf_m68k_relocate_section | |
49 PARAMS ((bfd *, struct bfd_link_info *, bfd *, asection *, bfd_byte *, | |
50 » Elf_Internal_Rela *, Elf_Internal_Sym *, asection **)); | |
51 static bfd_boolean elf_m68k_finish_dynamic_symbol | |
52 PARAMS ((bfd *, struct bfd_link_info *, struct elf_link_hash_entry *, | |
53 » Elf_Internal_Sym *)); | |
54 static bfd_boolean elf_m68k_finish_dynamic_sections | |
55 PARAMS ((bfd *, struct bfd_link_info *)); | |
56 | 33 |
57 static bfd_boolean elf32_m68k_set_private_flags | 34 static reloc_howto_type howto_table[] = |
58 PARAMS ((bfd *, flagword)); | 35 { |
59 static bfd_boolean elf32_m68k_merge_private_bfd_data | |
60 PARAMS ((bfd *, bfd *)); | |
61 static bfd_boolean elf32_m68k_print_private_bfd_data | |
62 PARAMS ((bfd *, PTR)); | |
63 static enum elf_reloc_type_class elf32_m68k_reloc_type_class | |
64 PARAMS ((const Elf_Internal_Rela *)); | |
65 | |
66 static reloc_howto_type howto_table[] = { | |
67 HOWTO(R_68K_NONE, 0, 0, 0, FALSE,0, complain_overflow_dont, bfd_elf_
generic_reloc, "R_68K_NONE", FALSE, 0, 0x00000000,FALSE), | 36 HOWTO(R_68K_NONE, 0, 0, 0, FALSE,0, complain_overflow_dont, bfd_elf_
generic_reloc, "R_68K_NONE", FALSE, 0, 0x00000000,FALSE), |
68 HOWTO(R_68K_32, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_32", FALSE, 0, 0xffffffff,FALSE), | 37 HOWTO(R_68K_32, 0, 2,32, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_32", FALSE, 0, 0xffffffff,FALSE), |
69 HOWTO(R_68K_16, 0, 1,16, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_16", FALSE, 0, 0x0000ffff,FALSE), | 38 HOWTO(R_68K_16, 0, 1,16, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_16", FALSE, 0, 0x0000ffff,FALSE), |
70 HOWTO(R_68K_8, 0, 0, 8, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_8", FALSE, 0, 0x000000ff,FALSE), | 39 HOWTO(R_68K_8, 0, 0, 8, FALSE,0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_8", FALSE, 0, 0x000000ff,FALSE), |
71 HOWTO(R_68K_PC32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_PC32", FALSE, 0, 0xffffffff,TRUE), | 40 HOWTO(R_68K_PC32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_PC32", FALSE, 0, 0xffffffff,TRUE), |
72 HOWTO(R_68K_PC16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_PC16", FALSE, 0, 0x0000ffff,TRUE), | 41 HOWTO(R_68K_PC16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_PC16", FALSE, 0, 0x0000ffff,TRUE), |
73 HOWTO(R_68K_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_PC8", FALSE, 0, 0x000000ff,TRUE), | 42 HOWTO(R_68K_PC8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_PC8", FALSE, 0, 0x000000ff,TRUE), |
74 HOWTO(R_68K_GOT32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_GOT32", FALSE, 0, 0xffffffff,TRUE), | 43 HOWTO(R_68K_GOT32, 0, 2,32, TRUE, 0, complain_overflow_bitfield, bfd_elf_
generic_reloc, "R_68K_GOT32", FALSE, 0, 0xffffffff,TRUE), |
75 HOWTO(R_68K_GOT16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_GOT16", FALSE, 0, 0x0000ffff,TRUE), | 44 HOWTO(R_68K_GOT16, 0, 1,16, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_GOT16", FALSE, 0, 0x0000ffff,TRUE), |
76 HOWTO(R_68K_GOT8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_GOT8", FALSE, 0, 0x000000ff,TRUE), | 45 HOWTO(R_68K_GOT8, 0, 0, 8, TRUE, 0, complain_overflow_signed, bfd_elf_
generic_reloc, "R_68K_GOT8", FALSE, 0, 0x000000ff,TRUE), |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
434 { BFD_RELOC_68K_TLS_LDO8, R_68K_TLS_LDO8 }, | 403 { BFD_RELOC_68K_TLS_LDO8, R_68K_TLS_LDO8 }, |
435 { BFD_RELOC_68K_TLS_IE32, R_68K_TLS_IE32 }, | 404 { BFD_RELOC_68K_TLS_IE32, R_68K_TLS_IE32 }, |
436 { BFD_RELOC_68K_TLS_IE16, R_68K_TLS_IE16 }, | 405 { BFD_RELOC_68K_TLS_IE16, R_68K_TLS_IE16 }, |
437 { BFD_RELOC_68K_TLS_IE8, R_68K_TLS_IE8 }, | 406 { BFD_RELOC_68K_TLS_IE8, R_68K_TLS_IE8 }, |
438 { BFD_RELOC_68K_TLS_LE32, R_68K_TLS_LE32 }, | 407 { BFD_RELOC_68K_TLS_LE32, R_68K_TLS_LE32 }, |
439 { BFD_RELOC_68K_TLS_LE16, R_68K_TLS_LE16 }, | 408 { BFD_RELOC_68K_TLS_LE16, R_68K_TLS_LE16 }, |
440 { BFD_RELOC_68K_TLS_LE8, R_68K_TLS_LE8 }, | 409 { BFD_RELOC_68K_TLS_LE8, R_68K_TLS_LE8 }, |
441 }; | 410 }; |
442 | 411 |
443 static reloc_howto_type * | 412 static reloc_howto_type * |
444 reloc_type_lookup (abfd, code) | 413 reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
445 bfd *abfd ATTRIBUTE_UNUSED; | 414 » » bfd_reloc_code_real_type code) |
446 bfd_reloc_code_real_type code; | |
447 { | 415 { |
448 unsigned int i; | 416 unsigned int i; |
449 for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) | 417 for (i = 0; i < sizeof (reloc_map) / sizeof (reloc_map[0]); i++) |
450 { | 418 { |
451 if (reloc_map[i].bfd_val == code) | 419 if (reloc_map[i].bfd_val == code) |
452 return &howto_table[reloc_map[i].elf_val]; | 420 return &howto_table[reloc_map[i].elf_val]; |
453 } | 421 } |
454 return 0; | 422 return 0; |
455 } | 423 } |
456 | 424 |
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1135 if (arch_mask & mcfmac) | 1103 if (arch_mask & mcfmac) |
1136 e_flags |= EF_M68K_CF_MAC; | 1104 e_flags |= EF_M68K_CF_MAC; |
1137 else if (arch_mask & mcfemac) | 1105 else if (arch_mask & mcfemac) |
1138 e_flags |= EF_M68K_CF_EMAC; | 1106 e_flags |= EF_M68K_CF_EMAC; |
1139 if (arch_mask & cfloat) | 1107 if (arch_mask & cfloat) |
1140 e_flags |= EF_M68K_CF_FLOAT | EF_M68K_CFV4E; | 1108 e_flags |= EF_M68K_CF_FLOAT | EF_M68K_CFV4E; |
1141 } | 1109 } |
1142 elf_elfheader (abfd)->e_flags = e_flags; | 1110 elf_elfheader (abfd)->e_flags = e_flags; |
1143 } | 1111 } |
1144 } | 1112 } |
error: old chunk mismatch |
None
OLD | NEW |