From 12241a34d72fe9be70e8c7001b05764bb7e9738e Mon Sep 17 00:00:00 2001 From: Tristan Gingold Date: Wed, 9 Apr 2014 10:12:45 +0200 Subject: [PATCH] Mach-O: add cpu and cpusubtype caps. include/mach-o/ 2014-04-16 Tristan Gingold * loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64) (BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define. bfd/ 2014-04-16 Tristan Gingold * mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype flag. --- bfd/ChangeLog | 5 +++++ bfd/mach-o-x86-64.c | 3 ++- include/mach-o/ChangeLog | 5 +++++ include/mach-o/loader.h | 9 ++++++++- 4 files changed, 20 insertions(+), 2 deletions(-) diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 99285f3a605..c9af9daca46 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2014-04-16 Tristan Gingold + + * mach-o-x86-64.c (bfd_mach_o_x86_64_mkobject): Adjust cpusubtype + flag. + 2014-04-16 Alan Modra * elf32-ppc.c (ppc_elf_relocate_section): Fill 476 fixup area diff --git a/bfd/mach-o-x86-64.c b/bfd/mach-o-x86-64.c index 221c030ac5c..017a6b89191 100644 --- a/bfd/mach-o-x86-64.c +++ b/bfd/mach-o-x86-64.c @@ -53,7 +53,8 @@ bfd_mach_o_x86_64_mkobject (bfd *abfd) mdata = bfd_mach_o_get_data (abfd); mdata->header.magic = BFD_MACH_O_MH_MAGIC_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 | BFD_MACH_O_CPU_SUBTYPE_LIB64; mdata->header.byteorder = BFD_ENDIAN_LITTLE; mdata->header.version = 2; diff --git a/include/mach-o/ChangeLog b/include/mach-o/ChangeLog index 284e845a809..0f2721a4164 100644 --- a/include/mach-o/ChangeLog +++ b/include/mach-o/ChangeLog @@ -1,3 +1,8 @@ +2014-04-16 Tristan Gingold + + * loader.h (BFD_MACH_O_CPU_ARCH_MASK, BFD_MACH_O_CPU_ARCH_ABI64) + (BFD_MACH_O_CPU_SUBTYPE_MASK, BFD_MACH_O_CPU_SUBTYPE_LIB64): Define. + 2014-04-03 Tristan Gingold * unwind.h (mach_o_compact_unwind_64): Fix typo in personality. diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h index 952346d6e60..20cfe42cf47 100644 --- a/include/mach-o/loader.h +++ b/include/mach-o/loader.h @@ -32,7 +32,10 @@ typedef enum bfd_mach_o_mach_header_magic } bfd_mach_o_mach_header_magic; -#define BFD_MACH_O_CPU_IS64BIT 0x1000000 +/* Capability bits in cpu type. */ +#define BFD_MACH_O_CPU_ARCH_MASK 0xff000000 +#define BFD_MACH_O_CPU_ARCH_ABI64 0x01000000 +#define BFD_MACH_O_CPU_IS64BIT 0x01000000 typedef enum bfd_mach_o_cpu_type { @@ -57,6 +60,10 @@ typedef enum bfd_mach_o_cpu_type } bfd_mach_o_cpu_type; +/* Capability bits in cpu subtype. */ +#define BFD_MACH_O_CPU_SUBTYPE_MASK 0xff000000 +#define BFD_MACH_O_CPU_SUBTYPE_LIB64 0x80000000 + typedef enum bfd_mach_o_cpu_subtype { /* i386. */ -- 2.30.2