commit befdc837990519cf9a44cc602d96d1cfb23ad62f
parent 22734d038a65c2f62fb6bf4e1a831018c1d234c2
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Thu, 16 Jul 2026 11:21:13 -0700
link: accept arm64e system stubs
Diffstat:
3 files changed, 45 insertions(+), 2 deletions(-)
diff --git a/doc/RELEASE_AUDIT_2026_6_0.md b/doc/RELEASE_AUDIT_2026_6_0.md
@@ -491,7 +491,7 @@ Implementation checkpoint (updated 2026-07-16):
| KIT-P2-007 | **Complete** | `test-selfdist`: 107 pass, 0 fail; release/dist gates reject the test signer ID after copy, comment changes, or valid reserialization |
| KIT-P1-012 | **Complete** | authenticated updater result cases included in `test-selfdist`: 107 pass, 0 fail |
| KIT-P1-001 | **Complete** | `target_test`: 177 checks, 0 failures; `test-driver-targets`: 61 pass, 0 fail |
-| KIT-P0-004 | **Complete** | public ELF/Mach-O/COFF matrix 103/0, including dylib/TBD device/simulator, import-library, pointer-width/endian boundaries; driver authority/inference/archive suite 15/0 |
+| KIT-P0-004 | **Complete** | public ELF/Mach-O/COFF matrix 106/0, including dylib/TBD device/simulator/arm64e, import-library, pointer-width/endian boundaries; driver authority/inference/archive suite 15/0 |
| KIT-P1-002 | **Complete** | NDK r27d NativeActivity preprocess/compile/shared-link at API 21 and 35: 3 pass, 0 fail |
| KIT-P1-003 | **Complete** | `test-smoke-rv32`: 20 pass, 0 fail, including concurrent empty-cache/read-only/QEMU cases |
| KIT-P1-004 | **Complete** | independent `llvm-readelf` rv32/rv64 soft/hard, mixed-ABI, and RVC merge oracle: 36 pass, 0 fail |
diff --git a/src/obj/macho/tbd_read.c b/src/obj/macho/tbd_read.c
@@ -109,6 +109,18 @@ static int tbd_supports_target(Compiler* c, const u8* data, size_t len,
memcmp(data + i + arch_len, platform, platform_len) == 0 &&
(after == end || !is_target_cont(data[after])))
return 1;
+ /* Current macOS SDK stubs advertise arm64e for system dylibs even
+ * when an ordinary arm64 consumer is being linked. ld64 accepts that
+ * ABI-compatible provider, so Kit must not reject the SDK's only ARM
+ * slice before symbol ingestion. */
+ if (c->target.arch == KIT_ARCH_ARM_64 &&
+ i + 6u + platform_len <= end &&
+ (i == line || !is_target_cont(data[i - 1u])) &&
+ memcmp(data + i, "arm64e", 6u) == 0 &&
+ memcmp(data + i + 6u, platform, platform_len) == 0 &&
+ (i + 6u + platform_len == end ||
+ !is_target_cont(data[i + 6u + platform_len])))
+ return 1;
}
return 0;
}
diff --git a/test/link/link_compat_test.c b/test/link/link_compat_test.c
@@ -449,9 +449,19 @@ static void check_macho_dso_boundary(void) {
" - targets: [ x86_64-ios-simulator ]\n"
" symbols: [ _audit_import ]\n"
"...\n";
+ static const uint8_t tbd_arm64e[] =
+ "--- !tapi-tbd\n"
+ "tbd-version: 4\n"
+ "targets: [ arm64e-macos ]\n"
+ "install-name: '/usr/lib/libAudit.dylib'\n"
+ "exports:\n"
+ " - targets: [ arm64e-macos ]\n"
+ " symbols: [ _audit_import ]\n"
+ "...\n";
KitCompiler* expected = NULL;
KitCompiler* elf_expected = NULL;
KitCompiler* simulator_expected = NULL;
+ KitCompiler* arm_expected = NULL;
KitLinkSession* s = NULL;
KitStatus st;
uint8_t native_bytes[32];
@@ -464,6 +474,8 @@ static void check_macho_dso_boundary(void) {
KitSlice platform_tbd = {.data = tbd_ios, .len = sizeof(tbd_ios) - 1u};
KitSlice simulator_tbd = {.data = tbd_ios_simulator,
.len = sizeof(tbd_ios_simulator) - 1u};
+ KitSlice arm64e_tbd = {.data = tbd_arm64e,
+ .len = sizeof(tbd_arm64e) - 1u};
EXPECT(kit_unit_compiler_new(
&g_u,
@@ -484,7 +496,14 @@ static void check_macho_dso_boundary(void) {
&simulator_expected) == KIT_OK &&
simulator_expected,
"iOS-simulator TBD boundary compiler");
- if (!expected || !elf_expected || !simulator_expected) goto done;
+ EXPECT(kit_unit_compiler_new(
+ &g_u,
+ kit_unit_target(KIT_ARCH_ARM_64, KIT_OS_MACOS, KIT_OBJ_MACHO),
+ &arm_expected) == KIT_OK &&
+ arm_expected,
+ "arm64e-compatible TBD boundary compiler");
+ if (!expected || !elf_expected || !simulator_expected || !arm_expected)
+ goto done;
s = new_reloc_session(expected);
EXPECT(s != NULL, "Mach-O DSO matching session");
@@ -507,6 +526,17 @@ static void check_macho_dso_boundary(void) {
s = NULL;
}
+ s = new_reloc_session(arm_expected);
+ EXPECT(s != NULL, "arm64e-compatible TBD session");
+ if (s) {
+ EXPECT(kit_link_session_add_dso_bytes(
+ s, KIT_SLICE_LIT("libnative-arm64e.tbd"), &arm64e_tbd) ==
+ KIT_OK,
+ "arm64 consumer accepts arm64e SDK stub");
+ kit_link_session_free(s);
+ s = NULL;
+ }
+
s = new_reloc_session(simulator_expected);
EXPECT(s != NULL, "device-TBD simulator mismatch session");
if (s) {
@@ -590,6 +620,7 @@ static void check_macho_dso_boundary(void) {
done:
if (s) kit_link_session_free(s);
+ if (arm_expected) kit_compiler_free(arm_expected);
if (simulator_expected) kit_compiler_free(simulator_expected);
if (elf_expected) kit_compiler_free(elf_expected);
if (expected) kit_compiler_free(expected);