fix(apple): preserve ARM64E X1 architecture identity

This commit is contained in:
morluto
2026-10-12 01:31:33 +08:00
parent bb508134ef
commit f598bab488
2 changed files with 24 additions and 13 deletions
@@ -218,6 +218,8 @@ const lipoRunner = (stdout: string): NativeCommandRunner => ({
// the same slice `arm64e`, and its physical identity must still match.
describe("artifact Mach-O arm64e variant slices", () => {
const ARM64E_V1 = { type: 0x0100000c, subtype: 0x81000002 } as const;
// CPU_SUBTYPE_ARM64E_X1 (12) with the pointer-auth ABI bit, as in macOS 27 /bin/ls.
const ARM64E_X1 = { type: 0x0100000c, subtype: 0x8000000c } as const;
const variantSlices = async (
cpu: { readonly type: number; readonly subtype: number },
lipo: (size: number) => string,
@@ -249,24 +251,29 @@ describe("artifact Mach-O arm64e variant slices", () => {
it.each([
[
"arm64e.v1",
ARM64E_V1,
" cputype CPU_TYPE_ARM64\n cpusubtype CPU_SUBTYPE_ARM64E\n capabilities PTR_AUTH_VERSION USERSPACE 1",
],
[
"arm64e.x1",
ARM64E_X1,
" cputype CPU_TYPE_ARM64\n cpusubtype unknown arm64 cpusubtype",
],
])("accepts lipo's %s name for the FAT arm64e slice", async (name, cpu) => {
expect(
await variantSlices(
ARM64E_V1,
(size) =>
`architecture ${name}\n${cpu}\n offset 8192\n size ${String(size)}\n align 2^12 (4096)\n`,
),
).toEqual([
["slices/x86_64", 4096],
[`slices/${name}`, 8192],
]);
});
])(
"accepts lipo's %s name for the FAT arm64e slice",
async (name, fatCpu, cpu) => {
expect(
await variantSlices(
fatCpu,
(size) =>
`architecture ${name}\n${cpu}\n offset 8192\n size ${String(size)}\n align 2^12 (4096)\n`,
),
).toEqual([
["slices/x86_64", 4096],
[`slices/${name}`, 8192],
]);
},
);
it.each([
["a plain arm64 slice", CPU.arm64, "8192"],