Line 22... |
Line 22... |
#include "sysdep.h"
|
#include "sysdep.h"
|
#include "mach-o.h"
|
#include "mach-o.h"
|
#include "bfd.h"
|
#include "bfd.h"
|
#include "libbfd.h"
|
#include "libbfd.h"
|
#include "libiberty.h"
|
#include "libiberty.h"
|
|
#include "mach-o/x86-64.h"
|
|
|
#define bfd_mach_o_object_p bfd_mach_o_x86_64_object_p
|
#define bfd_mach_o_object_p bfd_mach_o_x86_64_object_p
|
#define bfd_mach_o_core_p bfd_mach_o_x86_64_core_p
|
#define bfd_mach_o_core_p bfd_mach_o_x86_64_core_p
|
#define bfd_mach_o_mkobject bfd_mach_o_x86_64_mkobject
|
#define bfd_mach_o_mkobject bfd_mach_o_x86_64_mkobject
|
|
|
Line 49... |
Line 50... |
|
|
if (!bfd_mach_o_mkobject_init (abfd))
|
if (!bfd_mach_o_mkobject_init (abfd))
|
return FALSE;
|
return FALSE;
|
|
|
mdata = bfd_mach_o_get_data (abfd);
|
mdata = bfd_mach_o_get_data (abfd);
|
mdata->header.magic = BFD_MACH_O_MH_MAGIC;
|
mdata->header.magic = BFD_MACH_O_MH_MAGIC_64;
|
mdata->header.cputype = BFD_MACH_O_CPU_TYPE_X86_64;
|
mdata->header.cputype = BFD_MACH_O_CPU_TYPE_X86_64;
|
mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
|
mdata->header.cpusubtype = BFD_MACH_O_CPU_SUBTYPE_X86_ALL;
|
mdata->header.byteorder = BFD_ENDIAN_LITTLE;
|
mdata->header.byteorder = BFD_ENDIAN_LITTLE;
|
mdata->header.version = 1;
|
mdata->header.version = 2;
|
|
|
return TRUE;
|
return TRUE;
|
}
|
}
|
|
|
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
|
/* In case we're on a 32-bit machine, construct a 64-bit "-1" value. */
|
Line 218... |
Line 219... |
|
|
static bfd_boolean
|
static bfd_boolean
|
bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
|
bfd_mach_o_x86_64_swap_reloc_out (arelent *rel, bfd_mach_o_reloc_info *rinfo)
|
{
|
{
|
rinfo->r_address = rel->address;
|
rinfo->r_address = rel->address;
|
|
rinfo->r_scattered = 0;
|
switch (rel->howto->type)
|
switch (rel->howto->type)
|
{
|
{
|
case BFD_RELOC_64:
|
case BFD_RELOC_64:
|
rinfo->r_scattered = 0;
|
|
rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED;
|
rinfo->r_type = BFD_MACH_O_X86_64_RELOC_UNSIGNED;
|
rinfo->r_pcrel = 0;
|
rinfo->r_pcrel = 0;
|
rinfo->r_length = rel->howto->size; /* Correct in practice. */
|
rinfo->r_length = 3;
|
|
break;
|
|
case BFD_RELOC_32_PCREL:
|
|
rinfo->r_type = BFD_MACH_O_X86_64_RELOC_BRANCH;
|
|
rinfo->r_pcrel = 1;
|
|
rinfo->r_length = 2;
|
|
break;
|
|
case BFD_RELOC_MACH_O_X86_64_SUBTRACTOR64:
|
|
rinfo->r_type = BFD_MACH_O_X86_64_RELOC_SUBTRACTOR;
|
|
rinfo->r_pcrel = 0;
|
|
rinfo->r_length = 3;
|
|
break;
|
|
case BFD_RELOC_MACH_O_X86_64_GOT_LOAD:
|
|
rinfo->r_type = BFD_MACH_O_X86_64_RELOC_GOT_LOAD;
|
|
rinfo->r_pcrel = 1;
|
|
rinfo->r_length = 2;
|
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
|
if ((*rel->sym_ptr_ptr)->flags & BSF_SECTION_SYM)
|
{
|
{
|
rinfo->r_extern = 0;
|
rinfo->r_extern = 0;
|
rinfo->r_value = (*rel->sym_ptr_ptr)->section->target_index;
|
rinfo->r_value = (*rel->sym_ptr_ptr)->section->target_index;
|
}
|
}
|
else
|
else
|
{
|
{
|
rinfo->r_extern = 1;
|
rinfo->r_extern = 1;
|
rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
|
rinfo->r_value = (*rel->sym_ptr_ptr)->udata.i;
|
}
|
}
|
break;
|
|
default:
|
|
return FALSE;
|
|
}
|
|
return TRUE;
|
return TRUE;
|
}
|
}
|
|
|
static reloc_howto_type *
|
static reloc_howto_type *
|
bfd_mach_o_x86_64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
|
bfd_mach_o_x86_64_bfd_reloc_type_lookup (bfd *abfd ATTRIBUTE_UNUSED,
|