public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
* [Mach-O, committed]: Add definition for arm64 cpu
@ 2014-03-26 15:10 Tristan Gingold
  2014-03-26 16:24 ` Richard Earnshaw
  0 siblings, 1 reply; 7+ messages in thread
From: Tristan Gingold @ 2014-03-26 15:10 UTC (permalink / raw)
  To: binutils@sourceware.org Development

Hi,

this patch just add the new Mach-O cpu id for arm64 (aarch64).

Committed on trunk.

Tristan.

include/mach-o/
        * loader.h (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_ARM64.

bfd/
        * mach-o.c (bfd_mach_o_convert_architecture): Add
        BFD_MACH_O_CPU_TYPE_ARM64.

binutils/
        * od-macho.c (bfd_mach_o_cpu_name): Add BFD_MACH_O_CPU_TYPE_ARM64.

diff --git a/bfd/mach-o.c b/bfd/mach-o.c
index c77520a..6237602 100644
--- a/bfd/mach-o.c
+++ b/bfd/mach-o.c
@@ -905,6 +905,10 @@ bfd_mach_o_convert_architecture (bfd_mach_o_cpu_type mtype,
       *type = bfd_arch_powerpc;
       *subtype = bfd_mach_ppc64;
       break;
+    case BFD_MACH_O_CPU_TYPE_ARM64:
+      *type = bfd_arch_aarch64;
+      *subtype = bfd_mach_aarch64;
+      break;
     default:
       *type = bfd_arch_unknown;
       break;
index 3cd2cf0..6f88112 100644
--- a/binutils/od-macho.c
+++ b/binutils/od-macho.c
@@ -99,6 +99,7 @@ static const bfd_mach_o_xlat_name bfd_mach_o_cpu_name[] =
   { "powerpc", BFD_MACH_O_CPU_TYPE_POWERPC },
   { "powerpc_64", BFD_MACH_O_CPU_TYPE_POWERPC_64 },
   { "x86_64", BFD_MACH_O_CPU_TYPE_X86_64 },
+  { "arm64", BFD_MACH_O_CPU_TYPE_ARM64 },
   { NULL, 0}
 };
 
diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h
index f7b2b42..952346d 100644
--- a/include/mach-o/loader.h
+++ b/include/mach-o/loader.h
@@ -48,8 +48,12 @@ typedef enum bfd_mach_o_cpu_type
   BFD_MACH_O_CPU_TYPE_I860 = 15,
   BFD_MACH_O_CPU_TYPE_ALPHA = 16,
   BFD_MACH_O_CPU_TYPE_POWERPC = 18,
-  BFD_MACH_O_CPU_TYPE_POWERPC_64 = (BFD_MACH_O_CPU_TYPE_POWERPC | BFD_MACH_O_CPU_IS64BIT),
-  BFD_MACH_O_CPU_TYPE_X86_64 = (BFD_MACH_O_CPU_TYPE_I386 | BFD_MACH_O_CPU_IS64BIT)
+  BFD_MACH_O_CPU_TYPE_POWERPC_64 =
+    (BFD_MACH_O_CPU_TYPE_POWERPC | BFD_MACH_O_CPU_IS64BIT),
+  BFD_MACH_O_CPU_TYPE_X86_64 =
+    (BFD_MACH_O_CPU_TYPE_I386 | BFD_MACH_O_CPU_IS64BIT),
+  BFD_MACH_O_CPU_TYPE_ARM64 =
+    (BFD_MACH_O_CPU_TYPE_ARM | BFD_MACH_O_CPU_IS64BIT)
 }
 bfd_mach_o_cpu_type;

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 15:10 [Mach-O, committed]: Add definition for arm64 cpu Tristan Gingold
@ 2014-03-26 16:24 ` Richard Earnshaw
  2014-03-26 16:34   ` Tristan Gingold
  0 siblings, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2014-03-26 16:24 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: binutils@sourceware.org Development

On 26/03/14 15:10, Tristan Gingold wrote:
> Hi,
> 
> this patch just add the new Mach-O cpu id for arm64 (aarch64).
> 

I think the name used by binutils should be consistent: aarch64.  The
use of arm64 is going to be misleading.

R.

> Committed on trunk.
> 
> Tristan.
> 
> include/mach-o/
>         * loader.h (bfd_mach_o_cpu_type): Add BFD_MACH_O_CPU_TYPE_ARM64.
> 
> bfd/
>         * mach-o.c (bfd_mach_o_convert_architecture): Add
>         BFD_MACH_O_CPU_TYPE_ARM64.
> 
> binutils/
>         * od-macho.c (bfd_mach_o_cpu_name): Add BFD_MACH_O_CPU_TYPE_ARM64.
> 
> diff --git a/bfd/mach-o.c b/bfd/mach-o.c
> index c77520a..6237602 100644
> --- a/bfd/mach-o.c
> +++ b/bfd/mach-o.c
> @@ -905,6 +905,10 @@ bfd_mach_o_convert_architecture (bfd_mach_o_cpu_type mtype,
>        *type = bfd_arch_powerpc;
>        *subtype = bfd_mach_ppc64;
>        break;
> +    case BFD_MACH_O_CPU_TYPE_ARM64:
> +      *type = bfd_arch_aarch64;
> +      *subtype = bfd_mach_aarch64;
> +      break;
>      default:
>        *type = bfd_arch_unknown;
>        break;
> index 3cd2cf0..6f88112 100644
> --- a/binutils/od-macho.c
> +++ b/binutils/od-macho.c
> @@ -99,6 +99,7 @@ static const bfd_mach_o_xlat_name bfd_mach_o_cpu_name[] =
>    { "powerpc", BFD_MACH_O_CPU_TYPE_POWERPC },
>    { "powerpc_64", BFD_MACH_O_CPU_TYPE_POWERPC_64 },
>    { "x86_64", BFD_MACH_O_CPU_TYPE_X86_64 },
> +  { "arm64", BFD_MACH_O_CPU_TYPE_ARM64 },
>    { NULL, 0}
>  };
>  
> diff --git a/include/mach-o/loader.h b/include/mach-o/loader.h
> index f7b2b42..952346d 100644
> --- a/include/mach-o/loader.h
> +++ b/include/mach-o/loader.h
> @@ -48,8 +48,12 @@ typedef enum bfd_mach_o_cpu_type
>    BFD_MACH_O_CPU_TYPE_I860 = 15,
>    BFD_MACH_O_CPU_TYPE_ALPHA = 16,
>    BFD_MACH_O_CPU_TYPE_POWERPC = 18,
> -  BFD_MACH_O_CPU_TYPE_POWERPC_64 = (BFD_MACH_O_CPU_TYPE_POWERPC | BFD_MACH_O_CPU_IS64BIT),
> -  BFD_MACH_O_CPU_TYPE_X86_64 = (BFD_MACH_O_CPU_TYPE_I386 | BFD_MACH_O_CPU_IS64BIT)
> +  BFD_MACH_O_CPU_TYPE_POWERPC_64 =
> +    (BFD_MACH_O_CPU_TYPE_POWERPC | BFD_MACH_O_CPU_IS64BIT),
> +  BFD_MACH_O_CPU_TYPE_X86_64 =
> +    (BFD_MACH_O_CPU_TYPE_I386 | BFD_MACH_O_CPU_IS64BIT),
> +  BFD_MACH_O_CPU_TYPE_ARM64 =
> +    (BFD_MACH_O_CPU_TYPE_ARM | BFD_MACH_O_CPU_IS64BIT)
>  }
>  bfd_mach_o_cpu_type;
> 
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 16:24 ` Richard Earnshaw
@ 2014-03-26 16:34   ` Tristan Gingold
  2014-03-26 16:43     ` Marcus Shawcroft
  0 siblings, 1 reply; 7+ messages in thread
From: Tristan Gingold @ 2014-03-26 16:34 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: binutils@sourceware.org Development


On 26 Mar 2014, at 17:24, Richard Earnshaw <rearnsha@arm.com> wrote:

> On 26/03/14 15:10, Tristan Gingold wrote:
>> Hi,
>> 
>> this patch just add the new Mach-O cpu id for arm64 (aarch64).
>> 
> 
> I think the name used by binutils should be consistent: aarch64.  The
> use of arm64 is going to be misleading.

In fact it is consistent with the macro name defined by Apple :-(
Hard to be consistent with two non-consistent usages.

I don't know why arm64 is so common: at least in the Apple world
and in the linux kernel.

Tristan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 16:34   ` Tristan Gingold
@ 2014-03-26 16:43     ` Marcus Shawcroft
  2014-03-26 16:49       ` Richard Earnshaw
  2014-03-27  8:22       ` Tristan Gingold
  0 siblings, 2 replies; 7+ messages in thread
From: Marcus Shawcroft @ 2014-03-26 16:43 UTC (permalink / raw)
  To: Tristan Gingold; +Cc: Richard Earnshaw, binutils@sourceware.org Development

On 26 March 2014 16:34, Tristan Gingold <gingold@adacore.com> wrote:

> In fact it is consistent with the macro name defined by Apple :-(
> Hard to be consistent with two non-consistent usages.

That justification does not hold for the name string in bfd_mach_o_cpu_name[].

/Marcus

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 16:43     ` Marcus Shawcroft
@ 2014-03-26 16:49       ` Richard Earnshaw
  2014-03-27  8:18         ` Tristan Gingold
  2014-03-27  8:22       ` Tristan Gingold
  1 sibling, 1 reply; 7+ messages in thread
From: Richard Earnshaw @ 2014-03-26 16:49 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: Tristan Gingold, binutils@sourceware.org Development

On 26/03/14 16:43, Marcus Shawcroft wrote:
> On 26 March 2014 16:34, Tristan Gingold <gingold@adacore.com> wrote:
> 
>> In fact it is consistent with the macro name defined by Apple :-(
>> Hard to be consistent with two non-consistent usages.
> 
> That justification does not hold for the name string in bfd_mach_o_cpu_name[].
> 
> /Marcus
> 

Nor does it hold for the internal names, eg BFD_MACH_O_CPU_TYPE_ARM64

R.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 16:49       ` Richard Earnshaw
@ 2014-03-27  8:18         ` Tristan Gingold
  0 siblings, 0 replies; 7+ messages in thread
From: Tristan Gingold @ 2014-03-27  8:18 UTC (permalink / raw)
  To: Richard Earnshaw; +Cc: Marcus Shawcroft, binutils@sourceware.org Development


On 26 Mar 2014, at 17:49, Richard Earnshaw <rearnsha@arm.com> wrote:

> On 26/03/14 16:43, Marcus Shawcroft wrote:
>> On 26 March 2014 16:34, Tristan Gingold <gingold@adacore.com> wrote:
>> 
>>> In fact it is consistent with the macro name defined by Apple :-(
>>> Hard to be consistent with two non-consistent usages.
>> 
>> That justification does not hold for the name string in bfd_mach_o_cpu_name[].
>> 
>> /Marcus
>> 
> 
> Nor does it hold for the internal names, eg BFD_MACH_O_CPU_TYPE_ARM64

This is not an internal name, but was derived from an Apple header file.  Compare
the definition of bfd_mach_o_cpu_type with:

...
#define CPU_TYPE_MC98000        ((cpu_type_t) 10)
#define CPU_TYPE_HPPA           ((cpu_type_t) 11)
#define CPU_TYPE_ARM            ((cpu_type_t) 12)
#define CPU_TYPE_ARM64          (CPU_TYPE_ARM | CPU_ARCH_ABI64)
#define CPU_TYPE_MC88000        ((cpu_type_t) 13)
#define CPU_TYPE_SPARC          ((cpu_type_t) 14)
#define CPU_TYPE_I860           ((cpu_type_t) 15)
/* skip CPU_TYPE_ALPHA          ((cpu_type_t) 16)       */
/* skip                         ((cpu_type_t) 17)       */
#define CPU_TYPE_POWERPC                ((cpu_type_t) 18)
...

I added BFD_MACH_O_ prefix as a namespace.

Tristan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [Mach-O, committed]: Add definition for arm64 cpu
  2014-03-26 16:43     ` Marcus Shawcroft
  2014-03-26 16:49       ` Richard Earnshaw
@ 2014-03-27  8:22       ` Tristan Gingold
  1 sibling, 0 replies; 7+ messages in thread
From: Tristan Gingold @ 2014-03-27  8:22 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: Richard Earnshaw, binutils@sourceware.org Development


On 26 Mar 2014, at 17:43, Marcus Shawcroft <marcus.shawcroft@gmail.com> wrote:

> On 26 March 2014 16:34, Tristan Gingold <gingold@adacore.com> wrote:
> 
>> In fact it is consistent with the macro name defined by Apple :-(
>> Hard to be consistent with two non-consistent usages.
> 
> That justification does not hold for the name string in bfd_mach_o_cpu_name[].

The strings in bfd_mach_o_cpu_name corresponds to the cpu name part in the literal.
This is also compatible with the output of Apple tool:

/SDKs/iPhoneOS7.1.sdk/Developer/Library/Frameworks/SenTestingKit.framework/SenTestingKit (architecture arm64):

Note that (obviously) the BFD architecture of such binaries is bfd_arch_aarch64, and so will be
the bfd target.

Tristan.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2014-03-27  8:22 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-26 15:10 [Mach-O, committed]: Add definition for arm64 cpu Tristan Gingold
2014-03-26 16:24 ` Richard Earnshaw
2014-03-26 16:34   ` Tristan Gingold
2014-03-26 16:43     ` Marcus Shawcroft
2014-03-26 16:49       ` Richard Earnshaw
2014-03-27  8:18         ` Tristan Gingold
2014-03-27  8:22       ` Tristan Gingold

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).