commit 22734d038a65c2f62fb6bf4e1a831018c1d234c2
parent 3227411c46ee24313aa87c0dfd50467188faba13
Author: Ryan Sepassi <rsepassi@gmail.com>
Date: Thu, 16 Jul 2026 11:19:10 -0700
link: validate iOS simulator text stubs
Diffstat:
3 files changed, 55 insertions(+), 3 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 97/0, including dylib/TBD, import-library, pointer-width/endian boundaries; driver authority/inference/archive suite 15/0 |
+| 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-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
@@ -85,6 +85,9 @@ static int tbd_supports_target(Compiler* c, const u8* data, size_t len,
case KIT_OS_IOS:
platform = "-ios";
break;
+ case KIT_OS_IOS_SIMULATOR:
+ platform = "-ios-simulator";
+ break;
default:
return 0;
}
@@ -176,7 +179,10 @@ ObjBuilder* read_tbd(Compiler* c, const char* name, const u8* data, size_t len,
declares_targets) {
const char* arch =
c->target.arch == KIT_ARCH_ARM_64 ? "arm64" : "x86_64";
- const char* platform = c->target.os == KIT_OS_IOS ? "ios" : "macos";
+ const char* platform = c->target.os == KIT_OS_IOS_SIMULATOR
+ ? "ios-simulator"
+ : (c->target.os == KIT_OS_IOS ? "ios"
+ : "macos");
compiler_panic(c, SRCLOC_NONE,
"read_tbd: input '%s' does not support target %s-%s",
name ? name : "(unnamed)", arch, platform);
diff --git a/test/link/link_compat_test.c b/test/link/link_compat_test.c
@@ -440,8 +440,18 @@ static void check_macho_dso_boundary(void) {
" - targets: [ x86_64-ios ]\n"
" symbols: [ _audit_import ]\n"
"...\n";
+ static const uint8_t tbd_ios_simulator[] =
+ "--- !tapi-tbd\n"
+ "tbd-version: 4\n"
+ "targets: [ x86_64-ios-simulator ]\n"
+ "install-name: '/usr/lib/libAudit.dylib'\n"
+ "exports:\n"
+ " - targets: [ x86_64-ios-simulator ]\n"
+ " symbols: [ _audit_import ]\n"
+ "...\n";
KitCompiler* expected = NULL;
KitCompiler* elf_expected = NULL;
+ KitCompiler* simulator_expected = NULL;
KitLinkSession* s = NULL;
KitStatus st;
uint8_t native_bytes[32];
@@ -452,6 +462,8 @@ static void check_macho_dso_boundary(void) {
KitSlice foreign_tbd = {.data = tbd_arm64,
.len = sizeof(tbd_arm64) - 1u};
KitSlice platform_tbd = {.data = tbd_ios, .len = sizeof(tbd_ios) - 1u};
+ KitSlice simulator_tbd = {.data = tbd_ios_simulator,
+ .len = sizeof(tbd_ios_simulator) - 1u};
EXPECT(kit_unit_compiler_new(
&g_u,
@@ -465,7 +477,14 @@ static void check_macho_dso_boundary(void) {
&elf_expected) == KIT_OK &&
elf_expected,
"TBD format-boundary compiler");
- if (!expected || !elf_expected) goto done;
+ EXPECT(kit_unit_compiler_new(
+ &g_u,
+ kit_unit_target(KIT_ARCH_X86_64, KIT_OS_IOS_SIMULATOR,
+ KIT_OBJ_MACHO),
+ &simulator_expected) == KIT_OK &&
+ simulator_expected,
+ "iOS-simulator TBD boundary compiler");
+ if (!expected || !elf_expected || !simulator_expected) goto done;
s = new_reloc_session(expected);
EXPECT(s != NULL, "Mach-O DSO matching session");
@@ -477,6 +496,32 @@ static void check_macho_dso_boundary(void) {
s = NULL;
}
+ s = new_reloc_session(simulator_expected);
+ EXPECT(s != NULL, "matching iOS-simulator TBD session");
+ if (s) {
+ EXPECT(kit_link_session_add_dso_bytes(
+ s, KIT_SLICE_LIT("libnative-simulator.tbd"), &simulator_tbd) ==
+ KIT_OK,
+ "matching iOS-simulator TBD accepted");
+ kit_link_session_free(s);
+ s = NULL;
+ }
+
+ s = new_reloc_session(simulator_expected);
+ EXPECT(s != NULL, "device-TBD simulator mismatch session");
+ if (s) {
+ g_u.suppress_fatal = 1;
+ st = kit_link_session_add_dso_bytes(
+ s, KIT_SLICE_LIT("libdevice-only.tbd"), &platform_tbd);
+ g_u.suppress_fatal = 0;
+ EXPECT(st == KIT_ERR, "device-only TBD rejected by simulator link");
+ EXPECT(strstr(g_u.last_diag, "libdevice-only.tbd") != NULL &&
+ strstr(g_u.last_diag, "ios-simulator") != NULL,
+ "iOS-simulator TBD mismatch is named: %s", g_u.last_diag);
+ kit_link_session_free(s);
+ s = NULL;
+ }
+
s = new_reloc_session(expected);
EXPECT(s != NULL, "Mach-O DSO mismatch session");
if (s) {
@@ -545,6 +590,7 @@ static void check_macho_dso_boundary(void) {
done:
if (s) kit_link_session_free(s);
+ if (simulator_expected) kit_compiler_free(simulator_expected);
if (elf_expected) kit_compiler_free(elf_expected);
if (expected) kit_compiler_free(expected);
}