1 |
commit: 48ab29bc4227b69c55eb50190ecf73d569c114e9 |
2 |
Author: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
3 |
AuthorDate: Fri Jan 1 14:05:34 2021 +0000 |
4 |
Commit: Fabian Groffen <grobian <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Jan 1 14:05:34 2021 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/pax-utils.git/commit/?id=48ab29bc |
7 |
|
8 |
{,pax}macho: add support for arm64 arch |
9 |
|
10 |
Signed-off-by: Fabian Groffen <grobian <AT> gentoo.org> |
11 |
|
12 |
macho.h | 3 ++- |
13 |
paxmacho.c | 7 +++++-- |
14 |
2 files changed, 7 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/macho.h b/macho.h |
17 |
index 09caba1..7457473 100644 |
18 |
--- a/macho.h |
19 |
+++ b/macho.h |
20 |
@@ -1,5 +1,5 @@ |
21 |
/* |
22 |
- * Copyright 2008-2012 Gentoo Foundation |
23 |
+ * Copyright 2008-2021 Gentoo Foundation |
24 |
* Distributed under the terms of the GNU General Public License v2 |
25 |
*/ |
26 |
|
27 |
@@ -128,6 +128,7 @@ struct mach_header_64 |
28 |
/* cputype */ |
29 |
#define CPU_TYPE_POWERPC64 (CPU_TYPE_POWERPC | CPU_ARCH_ABI64) |
30 |
#define CPU_TYPE_X86_64 (CPU_TYPE_I386 | CPU_ARCH_ABI64) |
31 |
+#define CPU_TYPE_ARM64 (CPU_TYPE_ARM | CPU_ARCH_ABI64) |
32 |
|
33 |
struct load_command |
34 |
{ |
35 |
|
36 |
diff --git a/paxmacho.c b/paxmacho.c |
37 |
index 638453a..74f02da 100644 |
38 |
--- a/paxmacho.c |
39 |
+++ b/paxmacho.c |
40 |
@@ -1,10 +1,10 @@ |
41 |
/* |
42 |
- * Copyright 2003-2012 Gentoo Foundation |
43 |
+ * Copyright 2003-2021 Gentoo Foundation |
44 |
* Distributed under the terms of the GNU General Public License v2 |
45 |
* |
46 |
* Copyright 2005-2012 Ned Ludd - <solar@g.o> |
47 |
* Copyright 2005-2012 Mike Frysinger - <vapier@g.o> |
48 |
- * 2008-2012 Fabian Groffen - <grobian@g.o> |
49 |
+ * 2008-2021 Fabian Groffen - <grobian@g.o> |
50 |
*/ |
51 |
|
52 |
#include "paxinc.h" |
53 |
@@ -17,6 +17,7 @@ static const char STR_PPC64[] = "ppc64"; |
54 |
static const char STR_I386[] = "i386"; |
55 |
static const char STR_X86_64[] = "x86_64"; |
56 |
static const char STR_ARM[] = "arm"; /* iPhone */ |
57 |
+static const char STR_ARM64[] = "arm64"; /* Apple M1 */ |
58 |
static const char STR_UNKNOWN[] = "unknown"; |
59 |
|
60 |
#define QUERY(n) { #n, n } |
61 |
@@ -95,6 +96,7 @@ static pairtype macho_cputype[] = { |
62 |
QUERY(CPU_TYPE_ARM), |
63 |
QUERY(CPU_TYPE_POWERPC64), |
64 |
QUERY(CPU_TYPE_X86_64), |
65 |
+ QUERY(CPU_TYPE_ARM64), |
66 |
{ 0, 0 } |
67 |
}; |
68 |
const char *get_machocputype(fatobj *fobj) |
69 |
@@ -383,6 +385,7 @@ const char *get_machomtype(fatobj *fobj) |
70 |
case CPU_TYPE_ARM: return STR_ARM; |
71 |
case CPU_TYPE_POWERPC64: return STR_PPC64; |
72 |
case CPU_TYPE_X86_64: return STR_X86_64; |
73 |
+ case CPU_TYPE_ARM64: return STR_ARM64; |
74 |
default: return STR_UNKNOWN; |
75 |
} |
76 |
} |