diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7393dcf..b665839 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -72,6 +72,7 @@ jobs: OPENSSL_VERSION: 3.5.7 OPENSSL_TARGET: ${{ matrix.openssl_target }} CROSS_PREFIX: ${{ matrix.cross_prefix }} + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.target == 'macos-amd64' && '10.5' || '' }} run: | curl --fail --location --retry 3 \ "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \ @@ -105,6 +106,8 @@ jobs: - name: Build macOS executable with static OpenSSL if: startsWith(matrix.target, 'macos-') + env: + MACOSX_DEPLOYMENT_TARGET: ${{ matrix.target == 'macos-amd64' && '10.5' || '' }} run: | OPENSSL_LIBDIR="$(find "$GITHUB_WORKSPACE/openssl-static" -type f -name libssl.a -exec dirname {} \;)" make "${{ matrix.target }}" \ diff --git a/Makefile b/Makefile index 3358e45..f1e7ee6 100644 --- a/Makefile +++ b/Makefile @@ -102,6 +102,7 @@ else endif CC_MACOS_ARM64 ?= $(CC) CC_MACOS_AMD64 ?= $(CC) +MACOS_AMD64_MIN ?= 10.5 ifeq ($(HOST_ARCHNAME),ppc32be) CC_PPC32BE ?= $(CC) else @@ -153,7 +154,7 @@ $(DIST)/fossmark-macos-arm64: $(DRIVER) $(ASM_ARM64) | $(DIST) @echo "built $@" $(DIST)/fossmark-macos-amd64: $(DRIVER) $(ASM_AMD64) | $(DIST) - $(CC_MACOS_AMD64) -arch x86_64 $(CFLAGS) $(TLS_CFLAGS) $(PTHREAD) $(LDFLAGS) -o $@ $(DRIVER) $(ASM_AMD64) $(LDLIBS) + MACOSX_DEPLOYMENT_TARGET=$(MACOS_AMD64_MIN) $(CC_MACOS_AMD64) -arch x86_64 -mmacosx-version-min=$(MACOS_AMD64_MIN) $(CFLAGS) $(TLS_CFLAGS) $(PTHREAD) $(LDFLAGS) -Wl,-no_fixup_chains -o $@ $(DRIVER) $(ASM_AMD64) $(LDLIBS) @echo "built $@" # When the host is Linux/ARM64 or Linux/AMD64, the native binary IS one of the diff --git a/README.md b/README.md index a526945..4b6840c 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,11 @@ Apple Clang can build either macOS architecture with `-arch`. Windows timing and allocation code exists in the driver, but the Makefile does not include a Windows target and the x86-64 assembly currently follows the System V ABI. +The macOS AMD64 target is linked for macOS 10.5 and disables chained fixups so +its Mach-O load commands are understood by legacy Intel Macs. Override the +deployment floor when needed with `MACOS_AMD64_MIN`, for example +`make macos-amd64 MACOS_AMD64_MIN=10.8`. + Run the benchmark with extra per-test details by passing `--verbose`: ```sh diff --git a/src/main.c b/src/main.c index e02295b..0d912b7 100644 --- a/src/main.c +++ b/src/main.c @@ -35,13 +35,14 @@ #if defined(__APPLE__) # include # include +# include #endif /* Change this at build time with -DFM_API_BASE_URL=\"https://host\". */ #ifndef FM_API_BASE_URL # define FM_API_BASE_URL "https://fossbench.net" #endif -#define FM_VERSION "0.1.3-hotfix1" +#define FM_VERSION "0.1.3-hotfix2" /* ---------- platform identification (for the banner only) ---------- */ @@ -94,6 +95,18 @@ static double now_seconds(void) QueryPerformanceCounter(&t); return (double)t.QuadPart / (double)f.QuadPart; } +#elif defined(__APPLE__) +static double now_seconds(void) +{ + static mach_timebase_info_data_t timebase; + uint64_t ticks; + + if (timebase.denom == 0) + mach_timebase_info(&timebase); + ticks = mach_absolute_time(); + return (double)ticks * (double)timebase.numer / + (double)timebase.denom * 1e-9; +} #else # include static double now_seconds(void)