commit:     48ab29bc4227b69c55eb50190ecf73d569c114e9
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Fri Jan  1 14:05:34 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Fri Jan  1 14:05:34 2021 +0000
URL:        https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=48ab29bc

{,pax}macho: add support for arm64 arch

Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org>

 macho.h    | 3 ++-
 paxmacho.c | 7 +++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/macho.h b/macho.h
index 09caba1..7457473 100644
--- a/macho.h
+++ b/macho.h
@@ -1,5 +1,5 @@
 /*
- * Copyright 2008-2012 Gentoo Foundation
+ * Copyright 2008-2021 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  */
 
@@ -128,6 +128,7 @@ struct mach_header_64
 /* cputype */
 #define CPU_TYPE_POWERPC64  (CPU_TYPE_POWERPC | CPU_ARCH_ABI64)
 #define CPU_TYPE_X86_64     (CPU_TYPE_I386 | CPU_ARCH_ABI64)
+#define CPU_TYPE_ARM64      (CPU_TYPE_ARM | CPU_ARCH_ABI64)
 
 struct load_command
 {

diff --git a/paxmacho.c b/paxmacho.c
index 638453a..74f02da 100644
--- a/paxmacho.c
+++ b/paxmacho.c
@@ -1,10 +1,10 @@
 /*
- * Copyright 2003-2012 Gentoo Foundation
+ * Copyright 2003-2021 Gentoo Foundation
  * Distributed under the terms of the GNU General Public License v2
  *
  * Copyright 2005-2012 Ned Ludd        - <[email protected]>
  * Copyright 2005-2012 Mike Frysinger  - <[email protected]>
- *           2008-2012 Fabian Groffen  - <[email protected]>
+ *           2008-2021 Fabian Groffen  - <[email protected]>
  */
 
 #include "paxinc.h"
@@ -17,6 +17,7 @@ static const char STR_PPC64[]   = "ppc64";
 static const char STR_I386[]    = "i386";
 static const char STR_X86_64[]  = "x86_64";
 static const char STR_ARM[]     = "arm"; /* iPhone */
+static const char STR_ARM64[]   = "arm64"; /* Apple M1 */
 static const char STR_UNKNOWN[] = "unknown";
 
 #define QUERY(n) { #n, n }
@@ -95,6 +96,7 @@ static pairtype macho_cputype[] = {
        QUERY(CPU_TYPE_ARM),
        QUERY(CPU_TYPE_POWERPC64),
        QUERY(CPU_TYPE_X86_64),
+       QUERY(CPU_TYPE_ARM64),
        { 0, 0 }
 };
 const char *get_machocputype(fatobj *fobj)
@@ -383,6 +385,7 @@ const char *get_machomtype(fatobj *fobj)
                case CPU_TYPE_ARM:       return STR_ARM;
                case CPU_TYPE_POWERPC64: return STR_PPC64;
                case CPU_TYPE_X86_64:    return STR_X86_64;
+               case CPU_TYPE_ARM64:     return STR_ARM64;
                default:                 return STR_UNKNOWN;
        }
 }

Reply via email to