~ubuntu-branches/ubuntu/precise/binutils/precise-updates

« back to all changes in this revision

Viewing changes to bfd/mach-o-x86-64.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2011-08-11 22:51:48 UTC
  • mfrom: (1.7.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110811225148-y61bcrw1ukl0z2k2
Tags: 2.21.53.20110810-0ubuntu1
Snapshot, taken from the trunk 20110810.

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
#include "bfd.h"
25
25
#include "libbfd.h"
26
26
#include "libiberty.h"
 
27
#include "mach-o/x86-64.h"
27
28
 
28
29
#define bfd_mach_o_object_p bfd_mach_o_x86_64_object_p
29
30
#define bfd_mach_o_core_p bfd_mach_o_x86_64_core_p
51
52
    return FALSE;
52
53
 
53
54
  mdata = bfd_mach_o_get_data (abfd);
54
 
  mdata->header.magic = BFD_MACH_O_MH_MAGIC;
 
55
  mdata->header.magic = BFD_MACH_O_MH_MAGIC_64;
55
56
  mdata->header.cputype = BFD_MACH_O_CPU_TYPE_X86_64;
56
57
  mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
57
58
  mdata->header.byteorder = BFD_ENDIAN_LITTLE;
58
 
  mdata->header.version = 1;
 
59
  mdata->header.version = 2;
59
60
 
60
61
  return TRUE;
61
62
}
220
221
bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
221
222
{
222
223
  rinfo->r_address = rel->address;
 
224
  rinfo->r_scattered = 0;
223
225
  switch (rel->howto->type)
224
226
    {
225
227
    case BFD_RELOC_64:
226
 
      rinfo->r_scattered = 0;
227
228
      rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED;
228
229
      rinfo->r_pcrel = 0;
229
 
      rinfo->r_length = rel->howto->size; /* Correct in practice.  */
230
 
      if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
231
 
        {
232
 
          rinfo->r_extern = 0;
233
 
          rinfo->r_value = (*rel->sym_ptr_ptr)->section->target_index;
234
 
        }
235
 
      else
236
 
        {
237
 
          rinfo->r_extern = 1;
238
 
          rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
239
 
        }
 
230
      rinfo->r_length = 3;
 
231
      break;
 
232
    case BFD_RELOC_32_PCREL:
 
233
      rinfo->r_type = BFD_MACH_O_X86_64_RELOC_BRANCH;
 
234
      rinfo->r_pcrel = 1;
 
235
      rinfo->r_length = 2;
 
236
      break;
 
237
    case BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64:
 
238
      rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SUBTRACTOR;
 
239
      rinfo->r_pcrel = 0;
 
240
      rinfo->r_length = 3;
 
241
      break;
 
242
    case BFD_RELOC_MACH_O_X86_64_GOT_LOAD:
 
243
      rinfo->r_type = BFD_MACH_O_X86_64_RELOC_GOT_LOAD;
 
244
      rinfo->r_pcrel = 1;
 
245
      rinfo->r_length = 2;
240
246
      break;
241
247
    default:
242
248
      return FALSE;
243
249
    }
 
250
  if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
 
251
    {
 
252
      rinfo->r_extern = 0;
 
253
      rinfo->r_value = (*rel->sym_ptr_ptr)->section->target_index;
 
254
    }
 
255
  else
 
256
    {
 
257
      rinfo->r_extern = 1;
 
258
      rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
 
259
    }
244
260
  return TRUE;
245
261
}
246
262