| OLD | NEW |
| 1 /* X86-64 specific support for ELF | 1 /* X86-64 specific support for ELF |
| 2 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, | 2 Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, |
| 3 2010, 2011, 2012 | 3 2010, 2011, 2012, 2013 |
| 4 Free Software Foundation, Inc. | 4 Free Software Foundation, Inc. |
| 5 Contributed by Jan Hubicka <jh@suse.cz>. | 5 Contributed by Jan Hubicka <jh@suse.cz>. |
| 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. |
| 13 | 13 |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 MINUS_ONE, TRUE), | 141 MINUS_ONE, TRUE), |
| 142 HOWTO(R_X86_64_GOTPC64, 0, 4, 64, TRUE, 0, complain_overflow_signed, | 142 HOWTO(R_X86_64_GOTPC64, 0, 4, 64, TRUE, 0, complain_overflow_signed, |
| 143 bfd_elf_generic_reloc, "R_X86_64_GOTPC64", | 143 bfd_elf_generic_reloc, "R_X86_64_GOTPC64", |
| 144 FALSE, MINUS_ONE, MINUS_ONE, TRUE), | 144 FALSE, MINUS_ONE, MINUS_ONE, TRUE), |
| 145 HOWTO(R_X86_64_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_signed, | 145 HOWTO(R_X86_64_GOTPLT64, 0, 4, 64, FALSE, 0, complain_overflow_signed, |
| 146 bfd_elf_generic_reloc, "R_X86_64_GOTPLT64", FALSE, MINUS_ONE, | 146 bfd_elf_generic_reloc, "R_X86_64_GOTPLT64", FALSE, MINUS_ONE, |
| 147 MINUS_ONE, FALSE), | 147 MINUS_ONE, FALSE), |
| 148 HOWTO(R_X86_64_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_signed, | 148 HOWTO(R_X86_64_PLTOFF64, 0, 4, 64, FALSE, 0, complain_overflow_signed, |
| 149 bfd_elf_generic_reloc, "R_X86_64_PLTOFF64", FALSE, MINUS_ONE, | 149 bfd_elf_generic_reloc, "R_X86_64_PLTOFF64", FALSE, MINUS_ONE, |
| 150 MINUS_ONE, FALSE), | 150 MINUS_ONE, FALSE), |
| 151 EMPTY_HOWTO (32), | 151 HOWTO(R_X86_64_SIZE32, 0, 2, 32, FALSE, 0, complain_overflow_unsigned, |
| 152 EMPTY_HOWTO (33), | 152 » bfd_elf_generic_reloc, "R_X86_64_SIZE32", FALSE, 0xffffffff, 0xffffffff, |
| 153 » FALSE), |
| 154 HOWTO(R_X86_64_SIZE64, 0, 4, 64, FALSE, 0, complain_overflow_unsigned, |
| 155 » bfd_elf_generic_reloc, "R_X86_64_SIZE64", FALSE, MINUS_ONE, MINUS_ONE, |
| 156 » FALSE), |
| 153 HOWTO(R_X86_64_GOTPC32_TLSDESC, 0, 2, 32, TRUE, 0, | 157 HOWTO(R_X86_64_GOTPC32_TLSDESC, 0, 2, 32, TRUE, 0, |
| 154 complain_overflow_bitfield, bfd_elf_generic_reloc, | 158 complain_overflow_bitfield, bfd_elf_generic_reloc, |
| 155 "R_X86_64_GOTPC32_TLSDESC", | 159 "R_X86_64_GOTPC32_TLSDESC", |
| 156 FALSE, 0xffffffff, 0xffffffff, TRUE), | 160 FALSE, 0xffffffff, 0xffffffff, TRUE), |
| 157 HOWTO(R_X86_64_TLSDESC_CALL, 0, 0, 0, FALSE, 0, | 161 HOWTO(R_X86_64_TLSDESC_CALL, 0, 0, 0, FALSE, 0, |
| 158 complain_overflow_dont, bfd_elf_generic_reloc, | 162 complain_overflow_dont, bfd_elf_generic_reloc, |
| 159 "R_X86_64_TLSDESC_CALL", | 163 "R_X86_64_TLSDESC_CALL", |
| 160 FALSE, 0, 0, FALSE), | 164 FALSE, 0, 0, FALSE), |
| 161 HOWTO(R_X86_64_TLSDESC, 0, 4, 64, FALSE, 0, | 165 HOWTO(R_X86_64_TLSDESC, 0, 4, 64, FALSE, 0, |
| 162 complain_overflow_bitfield, bfd_elf_generic_reloc, | 166 complain_overflow_bitfield, bfd_elf_generic_reloc, |
| 163 "R_X86_64_TLSDESC", | 167 "R_X86_64_TLSDESC", |
| 164 FALSE, MINUS_ONE, MINUS_ONE, FALSE), | 168 FALSE, MINUS_ONE, MINUS_ONE, FALSE), |
| 165 HOWTO(R_X86_64_IRELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, | 169 HOWTO(R_X86_64_IRELATIVE, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, |
| 166 bfd_elf_generic_reloc, "R_X86_64_IRELATIVE", FALSE, MINUS_ONE, | 170 bfd_elf_generic_reloc, "R_X86_64_IRELATIVE", FALSE, MINUS_ONE, |
| 167 MINUS_ONE, FALSE), | 171 MINUS_ONE, FALSE), |
| 168 HOWTO(R_X86_64_RELATIVE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, | 172 HOWTO(R_X86_64_RELATIVE64, 0, 4, 64, FALSE, 0, complain_overflow_bitfield, |
| 169 bfd_elf_generic_reloc, "R_X86_64_RELATIVE64", FALSE, MINUS_ONE, | 173 bfd_elf_generic_reloc, "R_X86_64_RELATIVE64", FALSE, MINUS_ONE, |
| 170 MINUS_ONE, FALSE), | 174 MINUS_ONE, FALSE), |
| 175 HOWTO(R_X86_64_PC32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed, |
| 176 bfd_elf_generic_reloc, "R_X86_64_PC32_BND", FALSE, 0xffffffff, 0xfffffff
f, |
| 177 TRUE), |
| 178 HOWTO(R_X86_64_PLT32_BND, 0, 2, 32, TRUE, 0, complain_overflow_signed, |
| 179 bfd_elf_generic_reloc, "R_X86_64_PLT32_BND", FALSE, 0xffffffff, 0xffffff
ff, |
| 180 TRUE), |
| 171 | 181 |
| 172 /* We have a gap in the reloc numbers here. | 182 /* We have a gap in the reloc numbers here. |
| 173 R_X86_64_standard counts the number up to this point, and | 183 R_X86_64_standard counts the number up to this point, and |
| 174 R_X86_64_vt_offset is the value to subtract from a reloc type of | 184 R_X86_64_vt_offset is the value to subtract from a reloc type of |
| 175 R_X86_64_GNU_VT* to form an index into this table. */ | 185 R_X86_64_GNU_VT* to form an index into this table. */ |
| 176 #define R_X86_64_standard (R_X86_64_IRELATIVE + 1) | 186 #define R_X86_64_standard (R_X86_64_PLT32_BND + 1) |
| 177 #define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard) | 187 #define R_X86_64_vt_offset (R_X86_64_GNU_VTINHERIT - R_X86_64_standard) |
| 178 | 188 |
| 179 /* GNU extension to record C++ vtable hierarchy. */ | 189 /* GNU extension to record C++ vtable hierarchy. */ |
| 180 HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont, | 190 HOWTO (R_X86_64_GNU_VTINHERIT, 0, 4, 0, FALSE, 0, complain_overflow_dont, |
| 181 NULL, "R_X86_64_GNU_VTINHERIT", FALSE, 0, 0, FALSE), | 191 NULL, "R_X86_64_GNU_VTINHERIT", FALSE, 0, 0, FALSE), |
| 182 | 192 |
| 183 /* GNU extension to record C++ vtable member usage. */ | 193 /* GNU extension to record C++ vtable member usage. */ |
| 184 HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, FALSE, 0, complain_overflow_dont, | 194 HOWTO (R_X86_64_GNU_VTENTRY, 0, 4, 0, FALSE, 0, complain_overflow_dont, |
| 185 _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", FALSE, 0, 0, | 195 _bfd_elf_rel_vtable_reloc_fn, "R_X86_64_GNU_VTENTRY", FALSE, 0, 0, |
| 186 FALSE), | 196 FALSE), |
| 187 | 197 |
| 188 /* Use complain_overflow_bitfield on R_X86_64_32 for x32. */ | 198 /* Use complain_overflow_bitfield on R_X86_64_32 for x32. */ |
| 189 HOWTO(R_X86_64_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, | 199 HOWTO(R_X86_64_32, 0, 2, 32, FALSE, 0, complain_overflow_bitfield, |
| 190 bfd_elf_generic_reloc, "R_X86_64_32", FALSE, 0xffffffff, 0xffffffff, | 200 bfd_elf_generic_reloc, "R_X86_64_32", FALSE, 0xffffffff, 0xffffffff, |
| 191 FALSE) | 201 FALSE) |
| 192 }; | 202 }; |
| 193 | 203 |
| 194 #define IS_X86_64_PCREL_TYPE(TYPE) \ | 204 #define IS_X86_64_PCREL_TYPE(TYPE) \ |
| 195 ( ((TYPE) == R_X86_64_PC8) \ | 205 ( ((TYPE) == R_X86_64_PC8) \ |
| 196 || ((TYPE) == R_X86_64_PC16) \ | 206 || ((TYPE) == R_X86_64_PC16) \ |
| 197 || ((TYPE) == R_X86_64_PC32) \ | 207 || ((TYPE) == R_X86_64_PC32) \ |
| 208 || ((TYPE) == R_X86_64_PC32_BND) \ |
| 198 || ((TYPE) == R_X86_64_PC64)) | 209 || ((TYPE) == R_X86_64_PC64)) |
| 199 | 210 |
| 200 /* Map BFD relocs to the x86_64 elf relocs. */ | 211 /* Map BFD relocs to the x86_64 elf relocs. */ |
| 201 struct elf_reloc_map | 212 struct elf_reloc_map |
| 202 { | 213 { |
| 203 bfd_reloc_code_real_type bfd_reloc_val; | 214 bfd_reloc_code_real_type bfd_reloc_val; |
| 204 unsigned char elf_reloc_val; | 215 unsigned char elf_reloc_val; |
| 205 }; | 216 }; |
| 206 | 217 |
| 207 static const struct elf_reloc_map x86_64_reloc_map[] = | 218 static const struct elf_reloc_map x86_64_reloc_map[] = |
| (...skipping 23 matching lines...) Expand all Loading... |
| 231 { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, }, | 242 { BFD_RELOC_X86_64_GOTTPOFF, R_X86_64_GOTTPOFF, }, |
| 232 { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, }, | 243 { BFD_RELOC_X86_64_TPOFF32, R_X86_64_TPOFF32, }, |
| 233 { BFD_RELOC_64_PCREL, R_X86_64_PC64, }, | 244 { BFD_RELOC_64_PCREL, R_X86_64_PC64, }, |
| 234 { BFD_RELOC_X86_64_GOTOFF64, R_X86_64_GOTOFF64, }, | 245 { BFD_RELOC_X86_64_GOTOFF64, R_X86_64_GOTOFF64, }, |
| 235 { BFD_RELOC_X86_64_GOTPC32, R_X86_64_GOTPC32, }, | 246 { BFD_RELOC_X86_64_GOTPC32, R_X86_64_GOTPC32, }, |
| 236 { BFD_RELOC_X86_64_GOT64, R_X86_64_GOT64, }, | 247 { BFD_RELOC_X86_64_GOT64, R_X86_64_GOT64, }, |
| 237 { BFD_RELOC_X86_64_GOTPCREL64,R_X86_64_GOTPCREL64, }, | 248 { BFD_RELOC_X86_64_GOTPCREL64,R_X86_64_GOTPCREL64, }, |
| 238 { BFD_RELOC_X86_64_GOTPC64, R_X86_64_GOTPC64, }, | 249 { BFD_RELOC_X86_64_GOTPC64, R_X86_64_GOTPC64, }, |
| 239 { BFD_RELOC_X86_64_GOTPLT64, R_X86_64_GOTPLT64, }, | 250 { BFD_RELOC_X86_64_GOTPLT64, R_X86_64_GOTPLT64, }, |
| 240 { BFD_RELOC_X86_64_PLTOFF64, R_X86_64_PLTOFF64, }, | 251 { BFD_RELOC_X86_64_PLTOFF64, R_X86_64_PLTOFF64, }, |
| 252 { BFD_RELOC_SIZE32, R_X86_64_SIZE32, }, |
| 253 { BFD_RELOC_SIZE64, R_X86_64_SIZE64, }, |
| 241 { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, }, | 254 { BFD_RELOC_X86_64_GOTPC32_TLSDESC, R_X86_64_GOTPC32_TLSDESC, }, |
| 242 { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, }, | 255 { BFD_RELOC_X86_64_TLSDESC_CALL, R_X86_64_TLSDESC_CALL, }, |
| 243 { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, }, | 256 { BFD_RELOC_X86_64_TLSDESC, R_X86_64_TLSDESC, }, |
| 244 { BFD_RELOC_X86_64_IRELATIVE, R_X86_64_IRELATIVE, }, | 257 { BFD_RELOC_X86_64_IRELATIVE, R_X86_64_IRELATIVE, }, |
| 258 { BFD_RELOC_X86_64_PC32_BND, R_X86_64_PC32_BND,}, |
| 259 { BFD_RELOC_X86_64_PLT32_BND, R_X86_64_PLT32_BND,}, |
| 245 { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, }, | 260 { BFD_RELOC_VTABLE_INHERIT, R_X86_64_GNU_VTINHERIT, }, |
| 246 { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, | 261 { BFD_RELOC_VTABLE_ENTRY, R_X86_64_GNU_VTENTRY, }, |
| 247 }; | 262 }; |
| 248 | 263 |
| 249 static reloc_howto_type * | 264 static reloc_howto_type * |
| 250 elf_x86_64_rtype_to_howto (bfd *abfd, unsigned r_type) | 265 elf_x86_64_rtype_to_howto (bfd *abfd, unsigned r_type) |
| 251 { | 266 { |
| 252 unsigned i; | 267 unsigned i; |
| 253 | 268 |
| 254 if (r_type == (unsigned int) R_X86_64_32) | 269 if (r_type == (unsigned int) R_X86_64_32) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 332 /* Support for core dump NOTE sections. */ | 347 /* Support for core dump NOTE sections. */ |
| 333 static bfd_boolean | 348 static bfd_boolean |
| 334 elf_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) | 349 elf_x86_64_grok_prstatus (bfd *abfd, Elf_Internal_Note *note) |
| 335 { | 350 { |
| 336 int offset; | 351 int offset; |
| 337 size_t size; | 352 size_t size; |
| 338 | 353 |
| 339 switch (note->descsz) | 354 switch (note->descsz) |
| 340 { | 355 { |
| 341 default: | 356 default: |
error: old chunk mismatch |
None
| OLD | NEW |