| OLD | NEW |
| 1 /* IA-64 support for 64-bit ELF | 1 /* IA-64 support for OpenVMS |
| 2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, | 2 Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, |
| 3 2008, 2009, 2010, 2011 Free Software Foundation, Inc. | 3 2008, 2009, 2010, 2012 Free Software Foundation, Inc. |
| 4 Contributed by David Mosberger-Tang <davidm@hpl.hp.com> | |
| 5 | 4 |
| 6 This file is part of BFD, the Binary File Descriptor library. | 5 This file is part of BFD, the Binary File Descriptor library. |
| 7 | 6 |
| 8 This program is free software; you can redistribute it and/or modify | 7 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 | 8 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 | 9 the Free Software Foundation; either version 3 of the License, or |
| 11 (at your option) any later version. | 10 (at your option) any later version. |
| 12 | 11 |
| 13 This program is distributed in the hope that it will be useful, | 12 This program is distributed in the hope that it will be useful, |
| 14 but WITHOUT ANY WARRANTY; without even the implied warranty of | 13 but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 16 GNU General Public License for more details. | 15 GNU General Public License for more details. |
| 17 | 16 |
| 18 You should have received a copy of the GNU General Public License | 17 You should have received a copy of the GNU General Public License |
| 19 along with this program; if not, write to the Free Software | 18 along with this program; if not, write to the Free Software |
| 20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, | 19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, |
| 21 MA 02110-1301, USA. */ | 20 MA 02110-1301, USA. */ |
| 22 | 21 |
| 23 #include "sysdep.h" | 22 #include "sysdep.h" |
| 24 #include "bfd.h" | 23 #include "bfd.h" |
| 25 #include "libbfd.h" | 24 #include "libbfd.h" |
| 26 #include "elf-bfd.h" | 25 #include "elf-bfd.h" |
| 27 #include "opcode/ia64.h" | 26 #include "opcode/ia64.h" |
| 28 #include "elf/ia64.h" | 27 #include "elf/ia64.h" |
| 29 #include "objalloc.h" | 28 #include "objalloc.h" |
| 30 #include "hashtab.h" | 29 #include "hashtab.h" |
| 31 #include "bfd_stdint.h" | |
| 32 #include "elfxx-ia64.h" | 30 #include "elfxx-ia64.h" |
| 31 #include "vms.h" |
| 32 #include "bfdver.h" |
| 33 | 33 |
| 34 #define ARCH_SIZE» NN | 34 /* THE RULES for all the stuff the linker creates -- |
| 35 | 35 |
| 36 #if ARCH_SIZE == 64 | 36 GOT» » Entries created in response to LTOFF or LTOFF_FPTR |
| 37 #define»LOG_SECTION_ALIGN» 3 | 37 » » relocations. Dynamic relocs created for dynamic |
| 38 #endif | 38 » » symbols in an application; REL relocs for locals |
| 39 » » in a shared library. |
| 39 | 40 |
| 40 #if ARCH_SIZE == 32 | 41 FPTR» » The canonical function descriptor. Created for local |
| 41 #define»LOG_SECTION_ALIGN» 2 | 42 » » symbols in applications. Descriptors for dynamic symbols |
| 42 #endif | 43 » » and local symbols in shared libraries are created by |
| 44 » » ld.so. Thus there are no dynamic relocs against these |
| 45 » » objects. The FPTR relocs for such _are_ passed through |
| 46 » » to the dynamic relocation tables. |
| 43 | 47 |
| 44 /* Only add code for vms when the vms target is enabled. This is required | 48 FULL_PLT» Created for a PCREL21B relocation against a dynamic symbol. |
| 45 because it depends on vms-lib.c for its archive format and we don't want | 49 » » Requires the creation of a PLTOFF entry. This does not |
| 46 to compile that code if it is not used. */ | 50 » » require any dynamic relocations. |
| 47 #if ARCH_SIZE == 64 && \ | 51 |
| 48 (defined (HAVE_bfd_elf64_ia64_vms_vec) || defined (HAVE_all_vecs)) | 52 PLTOFF» Created by PLTOFF relocations. For local symbols, this |
| 49 #define INCLUDE_IA64_VMS | 53 » » is an alternate function descriptor, and in shared libraries |
| 50 #endif | 54 » » requires two REL relocations. Note that this cannot be |
| 55 » » transformed into an FPTR relocation, since it must be in |
| 56 » » range of the GP. For dynamic symbols, this is a function |
| 57 » » descriptor. */ |
| 51 | 58 |
| 52 typedef struct bfd_hash_entry *(*new_hash_entry_func) | 59 typedef struct bfd_hash_entry *(*new_hash_entry_func) |
| 53 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); | 60 (struct bfd_hash_entry *, struct bfd_hash_table *, const char *); |
| 54 | 61 |
| 55 /* In dynamically (linker-) created sections, we generally need to keep track | 62 /* In dynamically (linker-) created sections, we generally need to keep track |
| 56 of the place a symbol or expression got allocated to. This is done via hash | 63 of the place a symbol or expression got allocated to. This is done via hash |
| 57 tables that store entries of the following type. */ | 64 tables that store entries of the following type. */ |
| 58 | 65 |
| 59 struct elfNN_ia64_dyn_sym_info | 66 struct elf64_ia64_dyn_sym_info |
| 60 { | 67 { |
| 61 /* The addend for which this entry is relevant. */ | 68 /* The addend for which this entry is relevant. */ |
| 62 bfd_vma addend; | 69 bfd_vma addend; |
| 63 | 70 |
| 64 bfd_vma got_offset; | 71 bfd_vma got_offset; |
| 65 bfd_vma fptr_offset; | 72 bfd_vma fptr_offset; |
| 66 bfd_vma pltoff_offset; | 73 bfd_vma pltoff_offset; |
| 67 bfd_vma plt_offset; | 74 bfd_vma plt_offset; |
| 68 bfd_vma plt2_offset; | 75 bfd_vma plt2_offset; |
| 69 bfd_vma tprel_offset; | |
| 70 bfd_vma dtpmod_offset; | |
| 71 bfd_vma dtprel_offset; | |
| 72 | 76 |
| 73 /* The symbol table entry, if any, that this was derived from. */ | 77 /* The symbol table entry, if any, that this was derived from. */ |
| 74 struct elf_link_hash_entry *h; | 78 struct elf_link_hash_entry *h; |
| 75 | 79 |
| 76 /* Used to count non-got, non-plt relocations for delayed sizing | 80 /* Used to count non-got, non-plt relocations for delayed sizing |
| 77 of relocation sections. */ | 81 of relocation sections. */ |
| 78 struct elfNN_ia64_dyn_reloc_entry | 82 struct elf64_ia64_dyn_reloc_entry |
| 79 { | 83 { |
| 80 struct elfNN_ia64_dyn_reloc_entry *next; | 84 struct elf64_ia64_dyn_reloc_entry *next; |
| 81 asection *srel; | 85 asection *srel; |
| 82 int type; | 86 int type; |
| 83 int count; | 87 int count; |
| 84 | |
| 85 /* Is this reloc against readonly section? */ | |
| 86 bfd_boolean reltext; | |
| 87 } *reloc_entries; | 88 } *reloc_entries; |
| 88 | 89 |
| 89 /* TRUE when the section contents have been updated. */ | 90 /* TRUE when the section contents have been updated. */ |
| 90 unsigned got_done : 1; | 91 unsigned got_done : 1; |
| 91 unsigned fptr_done : 1; | 92 unsigned fptr_done : 1; |
| 92 unsigned pltoff_done : 1; | 93 unsigned pltoff_done : 1; |
| 93 unsigned tprel_done : 1; | |
| 94 unsigned dtpmod_done : 1; | |
| 95 unsigned dtprel_done : 1; | |
| 96 | 94 |
| 97 /* TRUE for the different kinds of linker data we want created. */ | 95 /* TRUE for the different kinds of linker data we want created. */ |
| 98 unsigned want_got : 1; | 96 unsigned want_got : 1; |
| 99 unsigned want_gotx : 1; | 97 unsigned want_gotx : 1; |
| 100 unsigned want_fptr : 1; | 98 unsigned want_fptr : 1; |
| 101 unsigned want_ltoff_fptr : 1; | 99 unsigned want_ltoff_fptr : 1; |
| 102 unsigned want_plt : 1; | 100 unsigned want_plt : 1;» /* A MIN_PLT entry. */ |
| 103 unsigned want_plt2 : 1; | 101 unsigned want_plt2 : 1;» /* A FULL_PLT. */ |
| 104 unsigned want_pltoff : 1; | 102 unsigned want_pltoff : 1; |
| 105 unsigned want_tprel : 1; | |
| 106 unsigned want_dtpmod : 1; | |
| 107 unsigned want_dtprel : 1; | |
| 108 }; | 103 }; |
| 109 | 104 |
| 110 struct elfNN_ia64_local_hash_entry | 105 struct elf64_ia64_local_hash_entry |
| 111 { | 106 { |
| 112 int id; | 107 int id; |
| 113 unsigned int r_sym; | 108 unsigned int r_sym; |
| 114 /* The number of elements in elfNN_ia64_dyn_sym_info array. */ | 109 /* The number of elements in elf64_ia64_dyn_sym_info array. */ |
| 115 unsigned int count; | 110 unsigned int count; |
| 116 /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ | 111 /* The number of sorted elements in elf64_ia64_dyn_sym_info array. */ |
| 117 unsigned int sorted_count; | 112 unsigned int sorted_count; |
| 118 /* The size of elfNN_ia64_dyn_sym_info array. */ | 113 /* The size of elf64_ia64_dyn_sym_info array. */ |
| 119 unsigned int size; | 114 unsigned int size; |
| 120 /* The array of elfNN_ia64_dyn_sym_info. */ | 115 /* The array of elf64_ia64_dyn_sym_info. */ |
| 121 struct elfNN_ia64_dyn_sym_info *info; | 116 struct elf64_ia64_dyn_sym_info *info; |
| 122 | 117 |
| 123 /* TRUE if this hash entry's addends was translated for | 118 /* TRUE if this hash entry's addends was translated for |
| 124 SHF_MERGE optimization. */ | 119 SHF_MERGE optimization. */ |
| 125 unsigned sec_merge_done : 1; | 120 unsigned sec_merge_done : 1; |
| 126 }; | 121 }; |
| 127 | 122 |
| 128 struct elfNN_ia64_link_hash_entry | 123 struct elf64_ia64_link_hash_entry |
| 129 { | 124 { |
| 130 struct elf_link_hash_entry root; | 125 struct elf_link_hash_entry root; |
| 131 /* The number of elements in elfNN_ia64_dyn_sym_info array. */ | 126 |
| 127 /* Set if this symbol is defined in a shared library. |
| 128 We can't use root.u.def.section->owner as the symbol is an absolute |
| 129 symbol. */ |
| 130 bfd *shl; |
| 131 |
| 132 /* The number of elements in elf64_ia64_dyn_sym_info array. */ |
| 132 unsigned int count; | 133 unsigned int count; |
| 133 /* The number of sorted elements in elfNN_ia64_dyn_sym_info array. */ | 134 /* The number of sorted elements in elf64_ia64_dyn_sym_info array. */ |
| 134 unsigned int sorted_count; | 135 unsigned int sorted_count; |
| 135 /* The size of elfNN_ia64_dyn_sym_info array. */ | 136 /* The size of elf64_ia64_dyn_sym_info array. */ |
| 136 unsigned int size; | 137 unsigned int size; |
| 137 /* The array of elfNN_ia64_dyn_sym_info. */ | 138 /* The array of elf64_ia64_dyn_sym_info. */ |
| 138 struct elfNN_ia64_dyn_sym_info *info; | 139 struct elf64_ia64_dyn_sym_info *info; |
| 139 }; | 140 }; |
| 140 | 141 |
| 141 struct elfNN_ia64_link_hash_table | 142 struct elf64_ia64_link_hash_table |
| 142 { | 143 { |
| 143 /* The main hash table. */ | 144 /* The main hash table. */ |
| 144 struct elf_link_hash_table root; | 145 struct elf_link_hash_table root; |
| 145 | 146 |
| 146 asection *fptr_sec; /* Function descriptor table (or NULL). */ | 147 asection *fptr_sec; /* Function descriptor table (or NULL). */ |
| 147 asection *rel_fptr_sec; /* Dynamic relocation section for same. */ | 148 asection *rel_fptr_sec; /* Dynamic relocation section for same. */ |
| 148 asection *pltoff_sec; /* Private descriptors for plt (or NULL). */ | 149 asection *pltoff_sec; /* Private descriptors for plt (or NULL). */ |
| 149 asection *rel_pltoff_sec;» /* Dynamic relocation section for same. */ | 150 asection *fixups_sec;»» /* Fixups section. */ |
| 151 asection *transfer_sec;» /* Transfer vector section. */ |
| 152 asection *note_sec;» » /* .note section. */ |
| 150 | 153 |
| 151 bfd_size_type minplt_entries; /* Number of minplt entries. */ | |
| 152 unsigned reltext : 1; /* Are there relocs against readonly sections?
*/ | |
| 153 unsigned self_dtpmod_done : 1;/* Has self DTPMOD entry been finished? */ | |
| 154 bfd_vma self_dtpmod_offset; /* .got offset to self DTPMOD entry. */ | |
| 155 /* There are maybe R_IA64_GPREL22 relocations, including those | 154 /* There are maybe R_IA64_GPREL22 relocations, including those |
| 156 optimized from R_IA64_LTOFF22X, against non-SHF_IA_64_SHORT | 155 optimized from R_IA64_LTOFF22X, against non-SHF_IA_64_SHORT |
| 157 sections. We need to record those sections so that we can choose | 156 sections. We need to record those sections so that we can choose |
| 158 a proper GP to cover all R_IA64_GPREL22 relocations. */ | 157 a proper GP to cover all R_IA64_GPREL22 relocations. */ |
| 159 asection *max_short_sec; /* Maximum short output section. */ | 158 asection *max_short_sec; /* Maximum short output section. */ |
| 160 bfd_vma max_short_offset; /* Maximum short offset. */ | 159 bfd_vma max_short_offset; /* Maximum short offset. */ |
| 161 asection *min_short_sec; /* Minimum short output section. */ | 160 asection *min_short_sec; /* Minimum short output section. */ |
| 162 bfd_vma min_short_offset; /* Minimum short offset. */ | 161 bfd_vma min_short_offset; /* Minimum short offset. */ |
| 163 | 162 |
| 164 htab_t loc_hash_table; | 163 htab_t loc_hash_table; |
error: old chunk mismatch |
None
| OLD | NEW |