| OLD | NEW |
| 1 /* Intel x86-64 Mach-O support for BFD. | 1 /* Intel x86-64 Mach-O support for BFD. |
| 2 Copyright 2010 | 2 Copyright 2010 |
| 3 Free Software Foundation, Inc. | 3 Free Software Foundation, Inc. |
| 4 | 4 |
| 5 This file is part of BFD, the Binary File Descriptor library. | 5 This file is part of BFD, the Binary File Descriptor library. |
| 6 | 6 |
| 7 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 |
| 8 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 |
| 9 the Free Software Foundation; either version 3 of the License, or | 9 the Free Software Foundation; either version 3 of the License, or |
| 10 (at your option) any later version. | 10 (at your option) any later version. |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 return FALSE; | 217 return FALSE; |
| 218 } | 218 } |
| 219 | 219 |
| 220 static bfd_boolean | 220 static bfd_boolean |
| 221 bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo) | 221 bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo) |
| 222 { | 222 { |
| 223 rinfo->r_address = rel->address; | 223 rinfo->r_address = rel->address; |
| 224 rinfo->r_scattered = 0; | 224 rinfo->r_scattered = 0; |
| 225 switch (rel->howto->type) | 225 switch (rel->howto->type) |
| 226 { | 226 { |
| 227 case BFD_RELOC_32: |
| 228 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED; |
| 229 rinfo->r_pcrel = 0; |
| 230 rinfo->r_length = 2; |
| 231 break; |
| 227 case BFD_RELOC_64: | 232 case BFD_RELOC_64: |
| 228 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED; | 233 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED; |
| 229 rinfo->r_pcrel = 0; | 234 rinfo->r_pcrel = 0; |
| 230 rinfo->r_length = 3; | 235 rinfo->r_length = 3; |
| 231 break; | 236 break; |
| 232 case BFD_RELOC_32_PCREL: | 237 case BFD_RELOC_32_PCREL: |
| 238 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SIGNED; |
| 239 rinfo->r_pcrel = 1; |
| 240 rinfo->r_length = 2; |
| 241 break; |
| 242 case BFD_RELOC_MACH_O_X86_64_PCREL32_1: |
| 243 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SIGNED_1; |
| 244 rinfo->r_pcrel = 1; |
| 245 rinfo->r_length = 2; |
| 246 break; |
| 247 case BFD_RELOC_MACH_O_X86_64_PCREL32_2: |
| 248 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SIGNED_2; |
| 249 rinfo->r_pcrel = 1; |
| 250 rinfo->r_length = 2; |
| 251 break; |
| 252 case BFD_RELOC_MACH_O_X86_64_PCREL32_4: |
| 253 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SIGNED_4; |
| 254 rinfo->r_pcrel = 1; |
| 255 rinfo->r_length = 2; |
| 256 break; |
| 257 case BFD_RELOC_MACH_O_X86_64_BRANCH32: |
| 233 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_BRANCH; | 258 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_BRANCH; |
| 234 rinfo->r_pcrel = 1; | 259 rinfo->r_pcrel = 1; |
| 235 rinfo->r_length = 2; | 260 rinfo->r_length = 2; |
| 236 break; | 261 break; |
| 262 case BFD_RELOC_MACH_O_X86_64_SUBTRACTOR32: |
| 263 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SUBTRACTOR; |
| 264 rinfo->r_pcrel = 0; |
| 265 rinfo->r_length = 2; |
| 266 break; |
| 237 case BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64: | 267 case BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64: |
| 238 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SUBTRACTOR; | 268 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SUBTRACTOR; |
| 239 rinfo->r_pcrel = 0; | 269 rinfo->r_pcrel = 0; |
| 240 rinfo->r_length = 3; | 270 rinfo->r_length = 3; |
| 241 break; | 271 break; |
| 272 case BFD_RELOC_MACH_O_X86_64_GOT: |
| 273 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_GOT; |
| 274 rinfo->r_pcrel = 1; |
| 275 rinfo->r_length = 2; |
| 276 break; |
| 242 case BFD_RELOC_MACH_O_X86_64_GOT_LOAD: | 277 case BFD_RELOC_MACH_O_X86_64_GOT_LOAD: |
| 243 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_GOT_LOAD; | 278 rinfo->r_type = BFD_MACH_O_X86_64_RELOC_GOT_LOAD; |
| 244 rinfo->r_pcrel = 1; | 279 rinfo->r_pcrel = 1; |
| 245 rinfo->r_length = 2; | 280 rinfo->r_length = 2; |
| 246 break; | 281 break; |
| 247 default: | 282 default: |
| 248 return FALSE; | 283 return FALSE; |
| 249 } | 284 } |
| 250 if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) | 285 if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM) |
| 251 { | 286 { |
| (...skipping 22 matching lines...) Expand all Loading... |
| 274 return NULL; | 309 return NULL; |
| 275 } | 310 } |
| 276 | 311 |
| 277 static reloc_howto_type * | 312 static reloc_howto_type * |
| 278 bfd_mach_o_x86_64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, | 313 bfd_mach_o_x86_64_bfd_reloc_name_lookup (bfd *abfd ATTRIBUTE_UNUSED, |
| 279 const char *name ATTRIBUTE_UNUSED) | 314 const char *name ATTRIBUTE_UNUSED) |
| 280 { | 315 { |
| 281 return NULL; | 316 return NULL; |
| 282 } | 317 } |
| 283 | 318 |
| 319 static bfd_boolean |
| 320 bfd_mach_o_section_type_valid_for_x86_64 (unsigned long val) |
| 321 { |
| 322 if (val == BFD_MACH_O_S_NON_LAZY_SYMBOL_POINTERS |
| 323 || val == BFD_MACH_O_S_LAZY_SYMBOL_POINTERS |
| 324 || val == BFD_MACH_O_S_SYMBOL_STUBS) |
| 325 return FALSE; |
| 326 return TRUE; |
| 327 } |
| 328 |
| 329 /* We want to bump the alignment of some sections. */ |
| 330 static const mach_o_section_name_xlat text_section_names_xlat[] = |
| 331 { |
| 332 { ".eh_frame", "__eh_frame", |
| 333 SEC_READONLY | SEC_DATA | SEC_LOAD, BFD_MACH_O_S_COALESCED, |
| 334 BFD_MACH_O_S_ATTR_LIVE_SUPPORT |
| 335 | BFD_MACH_O_S_ATTR_STRIP_STATIC_SYMS |
| 336 | BFD_MACH_O_S_ATTR_NO_TOC, 3}, |
| 337 { NULL, NULL, 0, 0, 0, 0} |
| 338 }; |
| 339 |
| 340 const mach_o_segment_name_xlat mach_o_x86_64_segsec_names_xlat[] = |
| 341 { |
| 342 { "__TEXT", text_section_names_xlat }, |
| 343 { NULL, NULL } |
| 344 }; |
| 345 |
| 284 #define bfd_mach_o_swap_reloc_in bfd_mach_o_x86_64_swap_reloc_in | 346 #define bfd_mach_o_swap_reloc_in bfd_mach_o_x86_64_swap_reloc_in |
| 285 #define bfd_mach_o_swap_reloc_out bfd_mach_o_x86_64_swap_reloc_out | 347 #define bfd_mach_o_swap_reloc_out bfd_mach_o_x86_64_swap_reloc_out |
| 286 | 348 |
| 287 #define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_x86_64_bfd_reloc_type_lookup | 349 #define bfd_mach_o_bfd_reloc_type_lookup bfd_mach_o_x86_64_bfd_reloc_type_lookup |
| 288 #define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_x86_64_bfd_reloc_name_lookup | 350 #define bfd_mach_o_bfd_reloc_name_lookup bfd_mach_o_x86_64_bfd_reloc_name_lookup |
| 289 #define bfd_mach_o_print_thread NULL | 351 #define bfd_mach_o_print_thread NULL |
| 352 #define bfd_mach_o_tgt_seg_table mach_o_x86_64_segsec_names_xlat |
| 353 #define bfd_mach_o_section_type_valid_for_tgt bfd_mach_o_section_type_valid_for_
x86_64 |
| 290 | 354 |
| 291 #define TARGET_NAME mach_o_x86_64_vec | 355 #define TARGET_NAME mach_o_x86_64_vec |
| 292 #define TARGET_STRING "mach-o-x86-64" | 356 #define TARGET_STRING "mach-o-x86-64" |
| 293 #define TARGET_ARCHITECTURE bfd_arch_i386 | 357 #define TARGET_ARCHITECTURE bfd_arch_i386 |
| 294 #define TARGET_BIG_ENDIAN 0 | 358 #define TARGET_BIG_ENDIAN 0 |
| 295 #define TARGET_ARCHIVE 0 | 359 #define TARGET_ARCHIVE 0 |
| 360 #define TARGET_PRIORITY 0 |
| 296 #include "mach-o-target.c" | 361 #include "mach-o-target.c" |
| OLD | NEW |