From 0dab9791cd2f37ab724dcc17488dcd73e8388968 Mon Sep 17 00:00:00 2001 From: "Ben L. Titzer" Date: Tue, 29 Sep 2026 20:41:37 -0400 Subject: [PATCH] [x86-64-darwin] Target and CI for x86-64-darwin --- .github/workflows/ci.yml | 13 ++++++++++ Makefile | 14 ++++++++++- ci/build-test.sh | 8 +++++-- scripts/sense_host.sh | 24 ++++++++++++++++++- .../correctness/failures.x86-64-darwin | 2 ++ test/regress.failures.x86-64-darwin | 2 ++ test/wasi/failures.x86-64-darwin | 6 +++++ 7 files changed, 65 insertions(+), 4 deletions(-) create mode 100644 test/monitors/whamm/monitors/correctness/failures.x86-64-darwin create mode 100644 test/regress.failures.x86-64-darwin create mode 100644 test/wasi/failures.x86-64-darwin diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2b4c5a35e..82c103edf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -182,6 +182,19 @@ jobs: with: name: x86-64-linux-o3 path: bin/*.x86-64-linux + x86_64-darwin: + runs-on: macos-15-intel # native x86-64 runner + steps: + - name: Checkout + uses: actions/checkout@v2 + - name: Build and Test + run: bash ./ci/build-test.sh x86-64-darwin + - name: Upload Built Binaries + if: always() + uses: actions/upload-artifact@v4 + with: + name: x86-64-darwin + path: bin/*.x86-64-darwin jvm: runs-on: ubuntu-latest steps: diff --git a/Makefile b/Makefile index d27ded1c6..43bb738bf 100644 --- a/Makefile +++ b/Makefile @@ -1,6 +1,6 @@ all: x86-linux x86-64-linux jvm -.PHONY: clean x86-linux x86-64-linux jvm wasm-wave +.PHONY: clean x86-linux x86-64-linux x86-64-darwin jvm wasm-wave clean: rm -f TAGS bin/* cp scripts/* bin/ @@ -11,6 +11,8 @@ arm64-linux: bin/wizeng.arm64-linux bin/unittest.arm64-linux x86-64-linux: bin/wizeng.x86-64-linux bin/unittest.x86-64-linux +x86-64-darwin: bin/wizeng.x86-64-darwin bin/unittest.x86-64-darwin + jvm: bin/wizeng.jvm bin/unittest.jvm wasm-wave: bin/wizeng.wasm bin/unittest.wasm @@ -90,6 +92,16 @@ bin/wizeng.x86-64-linux: $(WIZENG) $(MONITORS) $(WASI_X86_64_LINUX) $(WALI_X86_6 bin/objdump.x86-64-linux: $(OBJDUMP) $(X86_64) build.sh ./build.sh objdump x86-64-linux +# x86-64-darwin targets +bin/unittest.x86-64-darwin: $(UNITTEST) build.sh + ./build.sh unittest x86-64-darwin + +bin/wizeng.x86-64-darwin: $(WIZENG) $(MONITORS) build.sh + ./build.sh ${WIZENG_BUILD_SH_ARGS} wizeng x86-64-darwin + +bin/objdump.x86-64-darwin: $(OBJDUMP) build.sh + ./build.sh objdump x86-64-darwin + # interpreter targets bin/unittest.v3i: $(UNITTEST) build.sh ./build.sh unittest v3i diff --git a/ci/build-test.sh b/ci/build-test.sh index e37717412..23df06d42 100755 --- a/ci/build-test.sh +++ b/ci/build-test.sh @@ -44,8 +44,12 @@ export WIZENG_OPTS="$WIZENG_OPTS $WIZENG_RUNTIME_ARGS" make -j $TEST_TARGET # Install Opam for specification tests -sudo apt-get update -sudo apt-get install -y opam +if [ "$(uname -s)" = "Darwin" ]; then + brew install opam +else + sudo apt-get update + sudo apt-get install -y opam +fi opam init # Install spec test dependencies diff --git a/scripts/sense_host.sh b/scripts/sense_host.sh index 791918626..7d4acfcff 100755 --- a/scripts/sense_host.sh +++ b/scripts/sense_host.sh @@ -7,14 +7,36 @@ PLATFORM=$(uname -sm) HOSTS="" -if [[ "$PLATFORM" = "Darwin i386" || "$PLATFORM" = "Darwin x86_64" ]]; then +# Rosetta 2 allows arm64 Darwin machines to run x86-64 Darwin binaries. +# Set USE_ROSETTA2=1 to assume it is available, USE_ROSETTA2=0 to ignore it; +# otherwise sense it by looking for the runtime that its installer puts down. +ROSETTA2_RUNTIME=/Library/Apple/usr/libexec/oah/libRosettaRuntime + +function has_rosetta2() { + if [ -n "$USE_ROSETTA2" ]; then + [ "$USE_ROSETTA2" = 1 ] + return + fi + [ -f "$ROSETTA2_RUNTIME" ] +} + +if [[ "$PLATFORM" = "Darwin i386" ]]; then H="x86-darwin" HOSTS="$H $HOSTS" fi +if [[ "$PLATFORM" = "Darwin x86_64" ]]; then + H="x86-64-darwin" + HOSTS="$H $HOSTS" +fi + if [[ "$PLATFORM" = "Darwin arm64" ]]; then H="arm64-darwin" #TODO: unsupported target HOSTS="$H $HOSTS" + if has_rosetta2; then + H="x86-64-darwin" + HOSTS="$H $HOSTS" + fi fi if [[ "$PLATFORM" = "Linux i386" || "$PLATFORM" = "Linux i686" ]]; then diff --git a/test/monitors/whamm/monitors/correctness/failures.x86-64-darwin b/test/monitors/whamm/monitors/correctness/failures.x86-64-darwin new file mode 100644 index 000000000..1b325ddae --- /dev/null +++ b/test/monitors/whamm/monitors/correctness/failures.x86-64-darwin @@ -0,0 +1,2 @@ +last_store_noinline.wasm +gc_struct_new_inlined_probe.wasm diff --git a/test/regress.failures.x86-64-darwin b/test/regress.failures.x86-64-darwin new file mode 100644 index 000000000..f690c9783 --- /dev/null +++ b/test/regress.failures.x86-64-darwin @@ -0,0 +1,2 @@ +test/regress/core/mem4g.bin.wast +test/regress/ext:memory64/mem4g.bin.wast diff --git a/test/wasi/failures.x86-64-darwin b/test/wasi/failures.x86-64-darwin new file mode 100644 index 000000000..63635b865 --- /dev/null +++ b/test/wasi/failures.x86-64-darwin @@ -0,0 +1,6 @@ +// platform specific wasi apis are not implemented in x86-64-darwin yet +clock_time_get0.wasm +wasi_flag_dir01.wasm +wasi_prestat_get01.wasm +wasi_prestat_dir_name01.wasm +wasi_path_open00.wasm