Skip to content

Add macOS arm64 native support#66

Draft
huangminghuang wants to merge 11 commits into
masterfrom
feature/macos-arm64-native-support
Draft

Add macOS arm64 native support#66
huangminghuang wants to merge 11 commits into
masterfrom
feature/macos-arm64-native-support

Conversation

@huangminghuang
Copy link
Copy Markdown
Contributor

@huangminghuang huangminghuang commented May 26, 2026

Change Description

Adds Apple Silicon macOS support for CDT native/test builds while preserving deterministic wasm output across hosts.

Key changes:

  • Add macOS arm64 native CRT support and wire native CMake logic for Mach-O arm64.
  • Add an arm64 macOS GitHub Actions build using the vcpkg NuGet cache path, with a release triplet matching Linux cache behavior.
  • Make host-generated wasm outputs deterministic by normalizing source paths and keeping wasm softfloat stable across macOS arm64 and Linux x86_64.
  • Update native contract CMake macros so host-native contracts build as dlopen-able *_native.so modules on macOS, require C++17, preserve exported apply, and leave intrinsics unresolved for runtime lookup.
  • Update CDT-owned SoftFloat consumers to use explicit softfloat32_t, softfloat64_t, and softfloat128_t names instead of the legacy float*_t aliases.
  • Pin the softfloat submodule to the latest Wire-Network/berkeley-softfloat-3 master commit used by this branch.

Impact:

  • Apple Silicon developers can build CDT native support locally and in CI.
  • Native contract modules keep the .so suffix for platform-neutral discovery while becoming Mach-O bundles on macOS.
  • Linux behavior is retained, including shared libgcc_s/libstdc++ linkage for native modules.
  • CDT no longer depends on SoftFloat's legacy float*_t typedefs in native/rt code, avoiding collisions with platform headers while not forcing SOFTFLOAT_DISABLE_LEGACY_TYPE_ALIASES from CDT CMake.

API Changes

  • API Changes

Adds/updates CMake-facing native contract behavior through add_native_contract(): macOS outputs now explicitly use a .so suffix and C++17 is required for host-native module compilation.

Documentation Additions

  • Documentation Additions

Updates native tester compilation documentation for the macOS/native support behavior.

Testing

  • Configured CDT locally with vcpkg for arm64 macOS:
    cmake -S . -B build-apple-arm64-tests -G Ninja -DCMAKE_TOOLCHAIN_FILE=vcpkg/scripts/buildsystems/vcpkg.cmake -DVCPKG_TARGET_TRIPLET=arm64-osx -DENABLE_INTEGRATION_TESTS=OFF -DENABLE_NATIVE_COMPILER=ON
  • Built a CDT-only native smoke contract using add_native_contract().
  • Verified the smoke output is named smoke_native.so and reports Mach-O 64-bit bundle arm64.
  • Verified _apply is exported and native intrinsic symbols remain unresolved for host/runtime lookup.
  • Built standalone SoftFloat with Ninja from libraries/native/softfloat.
  • Reconfigured the warm arm64 macOS CDT build and built focused affected targets/objects:
    sf, rt, native/CMakeFiles/native.dir/intrinsics.cpp.obj, rt/CMakeFiles/native_rt.dir/compiler_builtins.cpp.obj
  • Ran git diff --check.

Build native test support on Apple Silicon, add the macOS arm64 vcpkg triplet and CI job, update vcpkg cache handling, pin softfloat, and make ABI descriptor merging deterministic.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant