64-bit intel
.It x86_64h
64-bit intel (haswell)
+.It arm64
+64-bit arm
+.It arm64e
+64-bit arm (Apple Silicon)
.El
.Pp
+If the binary does not contain code for
+.Ar arch_name ,
+the
+.Nm arch
+command may try to select a close match. If arm64 is specified and not found,
+arm64e will be tried next. If this happens, the order the architectures will
+be tried is not guaranteed.
+.Pp
Either prefix the architecture with a hyphen, or (for compatibility with
other commands), use
.Fl arch
be looked up in the corresponding property list file.
.Ss Example ARCHPREFERENCE Values
.Bl -tag -width " "
-.It i386,x86_64,x86_64h
+.It i386,x86_64,x86_64h,arm64,arm64e
A specifier that matches any name.
-.It foo:i386,x86_64,x86_64h
+.It foo:i386,x86_64,x86_64h,arm64,arm64e
A specifier that matches the program named
.Nm foo
(the full executable path is in the
.Pa foo.plist
file).
-.It foo:/op/bin/boo:i386,x86_64,x86_64h
+.It foo:/op/bin/boo:i386,x86_64,x86_64h,arm64,arm64e
A specifier with all fields specified.
-.It baz:i386;x86_64;x86_64h
+.It baz:i386;x86_64;x86_64h,arm64,arm64e
A specifier for
.Nm baz
and a second specifier that would match any other name.
{"x86_64h", CPU_TYPE_X86_64, CPU_SUBTYPE_X86_64_H},
{"arm", CPU_TYPE_ARM, CPU_SUBTYPE_ARM_ALL},
{"arm64", CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64_ALL},
+ /* rdar://65725144 ("arch -arm64" command should launch arm64e slice for 2-way fat x86_64+arm64e binaries) */
+ /* This will modify the order if someone, for whatever reason, specifies -arch arm64 -arch x86_64 -arch arm64e */
+ {"arm64", CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64E},
{"arm64e", CPU_TYPE_ARM64, CPU_SUBTYPE_ARM64E},
{"arm64_32", CPU_TYPE_ARM64_32, CPU_SUBTYPE_ARM64_32_ALL},
};
addCPUbyname(CPU *cpu, const char *name)
{
int i;
+ size_t numKnownArchs = sizeof(knownArchs)/sizeof(knownArchs[0]);
- for (i=0; i < sizeof(knownArchs)/sizeof(knownArchs[0]); i++) {
+ for (i=0; i < numKnownArchs; i++) {
if (!isSupportedCPU(knownArchs[i].cpu))
continue;
- if (0 == strcasecmp(name, knownArchs[i].arch)) {
+ int start = i;
+ /* rdar://65725144 ("arch -arm64" command should launch arm64e slice for 2-way fat x86_64+arm64e binaries) */
+ /* Add subtypes that closely match the specified name */
+ while ( i < numKnownArchs &&
+ 0 == strcasecmp(name, knownArchs[i].arch) ) {
addCPU(cpu, knownArchs[i].cpu, knownArchs[i].cpusubtype);
- return;
+ i++;
}
+ if (start != i)
+ return;
}
/* Didn't match a string in knownArchs */