Skip to content
This repository was archived by the owner on Oct 29, 2026. It is now read-only.
Avaneesh-InamdarPublic archive

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Adapter

Runs selected Intel macOS binaries on Windows x64. Adapter loads the original Mach-O code and supplies Darwin API adapters. Intel instructions run directly on the CPU. ARM64 translation is not implemented.

Build · API coverage · Phases · Working features · Work to do · Architecture · Contributing

API coverage

API adapter coverage

328 / 1,860 known Intel imports have adapters: 17.63%.

This counts unique (library install name, imported symbol) pairs from 18 inspected Apple Intel images, jq 1.8.2 and ripgrep 15.2.0. It includes imported data. An adapter may implement only part of an API. The percentage measures adapter availability, not application compatibility or total macOS completion. ARM64 and transitive dependencies are outside this count.

Program Direct imports with adapters API coverage Execution status
jq 1.8.2 136 / 136 100.00% 14 recorded tests passed
ripgrep 15.2.0 131 / 131 100.00% 11 recorded CLI tests passed
LogTool 25 / 34 73.53% Inspected; not run
Clipboard Viewer 11 / 55 20.00% Inspected; framework classes/AppKit missing
Xcode 27 launcher — — ARM64; no translator

Public API surface coverage

239 / 432 catalogued public APIs have adapters: 55.32% (66 of them partial).

The chart above counts only what the inspected binaries import. This one counts every symbol in the selected public headers catalogued here (libdispatch, the Block runtime, signals, pthread QoS, Mach VM, sysctl, libproc, posix_spawn and process control), pinned to Apple open-source commits. Adding a subsystem to the catalog is a small change in tools/extract_public_api.py.

All 20 Intel images · Missing APIs by target · Recorded imports and hashes

Regenerate the counts after adding adapters:

python tools/update_progress.py

This reads the source registries and committed import inventory. It does not run a guest binary or require the Apple archives. Do not edit the chart by hand. When adding a new target, see the inventory refresh command in the coverage notes.

What works

Area Implemented behavior Code / tests
Inspection Mach-O64 headers, FAT32/FAT64 selection, commands, sections, symbols and dependencies; .app executable discovery Inspector, parser tests
Intel loading PIE executables, local dylibs, two-level exports/reexports, classic and supported chained fixups, constructors and teardown Loader, runtime, integration tests
Dynamic loading Runtime dlopen/dlsym/dlclose/dlerror for classic and chained Intel dylibs and bundles; refcounted handles, RTLD_LOCAL/GLOBAL/NOLOAD/FIRST scope, per-image constructors/destructors and per-thread errors Dynamic registry, dlfcn adapters, plugin consumer, results
TLS and threads Per-image/per-thread TLV storage, C++ thread-local destruction, create/join, keys/destructor passes, once, errno, condition variables with signal/broadcast/timedwait Darwin modules, thread probes, results
libc C/POSIX rune data, separate Darwin FILE objects, binary I/O, printf-family varargs, UTF-8 paths/stat64, environment, selected time/string/math APIs Native adapters, libc tests
Mach IPC Simple messages between unchanged Mach-O processes through a loopback broker; receive/send/send-once rights, XNU header inversion, timeouts, LARGE retry, bootstrap check-in/lookup and retirement errors Mach adapter, broker, fixtures, results
launchd jobs Broker loads launchd-style plists, reserves MachServices names and starts registered jobs on first lookup or RunAtLoad; environment and log redirection, check-in wait, respawn after exit job parser, broker activation, results
XPC Unchanged libxpc client/server processes exchange typed dictionary messages and replies through the broker; listener check-in, demand spawn, accepted peers, event-handler blocks, typed containers, connection invalidation/interruption XPC adapter, server, client, results
Objective-C Raw-isa metadata, categories, protocols/properties, message dispatch, runtime-owned ARC/MRC strong and zeroing weak references, inherited ivar cleanup, custom RR and explicit pools Runtime, ABI contract, ARC results, other results
Guest debugging Windows LLDB captures actual exceptions, relocated Mach-O PCs, registers, disassembly and stacks; VM-address breakpoints and instruction stepping Debugger, usage and limits
Unwind-section discovery dyld image/header/path queries locate mapped compact-unwind and DWARF sections in startup images and runtime plugins; no frame walking or exception propagation yet dyld adapters, consumers and results
CoreFoundation Five functions for runtime-created UTF-8 strings, UTF-16 length and retain/release CF adapter, consumer
Grand Central Dispatch Serial/concurrent/root/main queues, sync and async submission, barriers, target queues, suspension and inactive queues, groups, dispatch_once, after, apply, block objects (wait/notify/cancel), timer and user-data sources, queue-specific data, finalizers; _Block_object_assign/dispose so __block variables and captured blocks survive copying Dispatch, block objects, sources, consumers, sources consumer, results
sysctl and libproc sysctl, sysctlbyname and sysctlnametomib answer about 75 kern/hw/machdep/user/vm names from host facts (processors, caches, memory, CPUID, boot time) and fixed Darwin 24.6 values that agree with uname; size queries, short buffers, read-only and error rules follow sysctl(3); libproc describes the guest's own process sysctl adapter, consumer, results
pthread QoS Classes and relative priorities recorded per thread and attribute; no scheduling effect QoS adapter, consumer
Signals Synchronous Darwin signals for the calling thread: signal/sigaction dispositions, sigprocmask/pthread_sigmask, sigset_t helpers, raise/kill/killpg on the guest pid, pending sets and sigwait, sa_mask and default termination (128 + signal) Signal adapter, consumer, default action, results
Real binary Original jq: JSON pipelines, Unicode, regex, files/modules, dates, math, diagnostics and exit codes; pinned upstream jq.test passes 550/550 jq tests, results
Second real binary Original ripgrep 15.2.0: recursive search, gitignore/hidden rules, JSON, PCRE2, UTF-8, stdin, binary detection, mmap, multithreaded search and exit codes ripgrep tests, results

Test state: the current run passed 192 distinct tests: 32 Rust, 30 archive and 130 integration tests. All 130 integration tests also passed in release. The integration run includes the unmodified jq binary executing jq's pinned upstream tests/jq.test suite with its module fixtures (550/550), the unmodified ripgrep binary exercising 11 CLI workflows, two unchanged Mach-O processes exchanging Mach messages through the broker, a broker-started launchd-style job reached by the same unchanged client, an unchanged libxpc client/server pair exchanging typed dictionary messages and replies, the Objective-C class and category consumers in classic, chained and relative fixup forms, and nine Windows LLDB guest-debugging cases. This is Windows-side evidence; the only reference-Mac executions are the hosted 4,096-case libc differential run, the 4,096-case Objective-C differential run , the 1,024-case threading differential run and the 30-case jq/ripgrep CLI differential, plus 4,096 protocol/property comparisons in the metadata differential. The ARC/weak run adds 1,024 comparisons at each compiler optimization level (-O0, -O2), matching in debug and release. Two unwind-discovery suites add 1,024 comparisons each for compact and DWARF-fallback executables, also matching in both builds. Current run · Summary.

Delivery phases

Delivery phases

All 36 requested work items are assigned in the phase work list. The graph records dependencies and implemented slices. The API percentage above uses a measured import inventory; it is not a percentage of macOS completed.

Phase Scope Current state
P0 Mac reference, differential probes, guest debugging, ABI contracts First 4,096-case Mac comparison matches in debug and release; nine debugger tests pass in both profiles; expand coverage per subsystem
P1 Shared cache, Objective-C, Swift, unwind, Mach VM Intel loader, runtime-owned ARC/weak references, dyld unwind-section discovery and Mach VM slices work; shared cache, Swift and frame unwinding remain
P2 GCD, Foundation, runloops, IPC, XPC, launchd, processes, daemons, signals Simple IPC, job, XPC, synchronous signal, GCD and sysctl slices work; broader system behavior remains
P3 Graphics, IOSurface, Metal, AppKit, SwiftUI, WindowServer Not started
P4 ARM64 backend, 16K pages, memory ordering, arm64e Native Windows ARM64 preferred when hardware is available; no ARM execution yet
P5 Debugserver primitives, signing/keychain, tool/SDK paths, Xcode Not started; all five application gates pending
P6 Instruments, devices, Simulator Not started; Simulator deferred

The application gates are binary pass/fail: NSWindow hello-world → xcodebuild → Xcode welcome window → open project → build project. None has passed. See acceptance criteria, versioned ABI contracts and the upstream source catalog for implementation starting points. The catalog distinguishes reusable code from Apple-dependent implementations and private components for which no complete public implementation was found.

Work to do

Work Current gap Start here Needed evidence
Reference-Mac comparison Hosted Intel Mac libc differential passes 4,096/4,096 in debug and release; Objective-C, threading, jq/ripgrep and service ordering still need reference captures Harness, reference workflow, results Extend same-artifact probes and retain OS, hashes and failure details
TLS lifecycle In-process C++ TLV destruction works; shared-cache TLVs, __cxa_thread_atexit and exact Darwin destructor ordering are unverified TLS planning, TLV runtime Shared-cache and cross-compiler consumers plus reference ordering
Synchronization Condition variables work in-process; no cancellation, process-shared objects, errorcheck/adaptive mutexes or nondefault scheduling Sync adapters, threads Cancellation/cleanup and cross-process lifetime tests
Dynamic loading Runtime load works, but images are never unmapped; dynamic TLS and @rpath arguments are rejected, RTLD_NEXT/RTLD_SELF and dladdr are absent, and cross-group dependency sharing, interposition, ObjC registration and cyclic initialization are unsupported Dynamic registry, roadmap D1 True unload, TLS-bearing plugins, RTLD_NEXT/interposition and a pinned real plugin consumer
OS services Mach ports, simple messages, a bootstrap table, broker-started launchd-style jobs and simple XPC connections work across processes; complex messages, launchd supervision/launchctl, XPC beyond the typed dictionary subset and fork/exec are absent Roadmap D2-D5, Mach results, launchd results, XPC results Complex-message and pinned real Mach consumers, launchd supervision/KeepAlive and socket activation, and XPC interoperability with a real macOS peer; none is implied by POSIX adapters
Objective-C Runtime-owned ARC/MRC, weak references and metadata queries work; ARC Blocks, foreign objects, atomic/copy properties, dynamic registration, exceptions and aggregate/x87 sends remain ABI contract, ARC results, missing imports Add each lifetime/image extension with positive, rejection and native Mac probes
Frameworks and GUI Foundation, AppKit and SwiftUI absent; CF limited to strings Framework adapters, Apple target inventory Grow APIs from a chosen target; test object lifetime, resources, windows and events
libc completeness Missing APIs and partial semantics: Unicode locales, cookie streams, wide/positional/long-double formatting, filesystem metadata, date formats and timezone behavior ABI adapters, API contracts Focused Mach-O probes and same-artifact output/error comparisons
Grand Central Dispatch Queues, groups, block objects and timer/user-data sources work; 8 source types (descriptor, process, signal, Mach, vnode, memory pressure), dispatch_data, dispatch_io, workloops and QoS scheduling are absent Dispatch results, public-API gaps Kernel-event-backed sources with consumers, then a reference-Mac comparison of ordering and coalescing
Process creation fork, exec*, posix_spawn and waitpid are registered only to fail with ENOSYS/ECHILD; spawn attributes and file actions are recorded but never applied. 39 of 53 catalogued spawn and process-control symbols are absent Public-API gaps, spawn stubs posix_spawn and execve over a re-entered Adapter instance, descriptor and environment inheritance, waitpid of real children
Exceptions and OS services No Darwin unwinder, asynchronous/per-thread signals, siginfo, fault-to-signal mapping, syscall personality, complex Mach messages, networking or fork/exec Runtime, limitations Separate consumers for each service and failure path
ARM64 and Xcode ARM instructions cannot execute through the Intel loader; private frameworks/services also missing Xcode findings, roadmap ARM64 execution first, then measured framework/service bring-up

What the public-API catalog shows. Counting every symbol in the public headers (not just what the 18 inspected binaries import) puts the subsystems built so far at 239 of 432 symbols with an adapter, 66 of them partial or always failing. The largest gaps are dispatch_data, dispatch_io and workloops (0 of 27), 36 of 42 Mach VM routines (region queries, read/write/copy, remap), 39 of 53 process-control and spawn symbols, 60 of 135 sysctl names, 26 of 31 libproc calls and 5 of 28 signal calls. Those are the largest measurable gaps.

Choose a consumer from the missing-API inventory, implement the required behavior and add a test. objc_msgSend and related runtime imports occur in most inspected Apple apps. The bounded dispatcher now exists; those apps still require additional metadata, frameworks and services before they can execute.

Build and run

Requires Windows x64, Rust's MSVC toolchain, Visual C++/Windows SDK build tools, Python 3.12+, and LLVM with clang, ld64.lld, llvm-ar and clang-format. The recorded environment used Rust 1.99.0 and LLVM 23.1.3. LLVM defaults to C:\Program Files\LLVM\bin; override it with ADAPTER_LLVM.

git clone https://github.com/Avaneesh-Inamdar/Adapter.git
cd Adapter
cargo build --locked
python tests/build_fixtures.py
python tools/fetch_jq.py
python tools/fetch_ripgrep.py
python tools/verify.py

Reference fetches are pinned by SHA-256. No Mac or Apple SDK is needed for the test fixtures. Downloaded binaries and supplied Apple archives stay out of Git.

target/debug/adapter-run.exe tests/fixtures/generated/reference/jq-macos-amd64 -- --version
'{"a":[1,2,3]}' | target/debug/adapter-run.exe tests/fixtures/generated/reference/jq-macos-amd64 -- -c '.a | map(. * 2)'

target/debug/adapter-inspect.exe --json tests/fixtures/generated/reference/jq-macos-amd64
target/debug/adapter-run.exe --check tests/fixtures/generated/reference/jq-macos-amd64

target/debug/adapter-run.exe tests/fixtures/generated/reference/ripgrep-macos-amd64 -- --version
printf 'alpha\nneedle here\n' | target/debug/adapter-run.exe tests/fixtures/generated/reference/ripgrep-macos-amd64 -- -n needle

--check performs static preflight; it does not execute or certify the program. Put guest arguments after --. Guest exit codes are preserved; runtime errors return 125. The worker timeout defaults to 10 seconds (--timeout 1..3600). The worker has the user's process permissions; it is not a security sandbox.

Mach ports and bootstrap services are process-local unless a broker is running. Start it once, then point each worker at its endpoint file:

target\debug\adapter-broker.exe --endpoint broker.json
$env:ADAPTER_MACH_BROKER = (Resolve-Path broker.json).Path

Pass --job job.plist to register a launchd-style job. A lookup for one of its MachServices names starts adapter-run with the job's program, arguments, environment and log paths; RunAtLoad starts it when the broker loads. The broker is a trusted local message, job and XPC router, not a security boundary and not launchd: there is no launchctl, KeepAlive, supervision or socket activation, and XPC is an Adapter-defined transport between workers rather than Apple's wire format. A missing endpoint file makes adapter-run exit 125 before guest entry. See launchd results and XPC results.

Guest paths /C/Users/... and /E/... map to Windows drives. Use that spelling for jq -L module search paths so macOS code recognizes them as absolute. Native Windows paths also work for ordinary file opens. --config FILE accepts JSON sysroot and library_paths fields.

Adding support

  1. Pick a target from the import inventory and check its architecture and current loader blockers.
  2. Find the missing behavior in the owning library. Guest calls use Darwin x86-64 SysV; host calls use Windows conventions. Translate structures and varargs explicitly; do not pass Darwin FILE/stat/tm/va_list objects to the CRT.
  3. Add a Mach-O consumer under tests/fixtures or a pinned real-binary regression under tests/integration. Cover failure behavior as well as the successful call.
  4. Update the owning ABI contract, run python tools/verify.py, then run python tools/update_progress.py and commit the regenerated coverage. Update phase states only when their recorded evidence changes.

Detailed roadmap · Architecture · Known limitations · Contribution guide

Source is MIT licensed. External test artifacts retain their own licenses. Adapter is independent of Apple, jq and ripgrep.

About

No description, website, or topics provided.

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages