Support legacy Intel macOS loaders

This commit is contained in:
2026-07-17 18:51:31 -05:00
parent 0662bfe52d
commit 28b3ac266b
4 changed files with 24 additions and 2 deletions
+3
View File
@@ -72,6 +72,7 @@ jobs:
OPENSSL_VERSION: 3.5.7 OPENSSL_VERSION: 3.5.7
OPENSSL_TARGET: ${{ matrix.openssl_target }} OPENSSL_TARGET: ${{ matrix.openssl_target }}
CROSS_PREFIX: ${{ matrix.cross_prefix }} CROSS_PREFIX: ${{ matrix.cross_prefix }}
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.target == 'macos-amd64' && '10.5' || '' }}
run: | run: |
curl --fail --location --retry 3 \ curl --fail --location --retry 3 \
"https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \ "https://www.openssl.org/source/openssl-${OPENSSL_VERSION}.tar.gz" \
@@ -105,6 +106,8 @@ jobs:
- name: Build macOS executable with static OpenSSL - name: Build macOS executable with static OpenSSL
if: startsWith(matrix.target, 'macos-') if: startsWith(matrix.target, 'macos-')
env:
MACOSX_DEPLOYMENT_TARGET: ${{ matrix.target == 'macos-amd64' && '10.5' || '' }}
run: | run: |
OPENSSL_LIBDIR="$(find "$GITHUB_WORKSPACE/openssl-static" -type f -name libssl.a -exec dirname {} \;)" OPENSSL_LIBDIR="$(find "$GITHUB_WORKSPACE/openssl-static" -type f -name libssl.a -exec dirname {} \;)"
make "${{ matrix.target }}" \ make "${{ matrix.target }}" \
+2 -1
View File
@@ -102,6 +102,7 @@ else
endif endif
CC_MACOS_ARM64 ?= $(CC) CC_MACOS_ARM64 ?= $(CC)
CC_MACOS_AMD64 ?= $(CC) CC_MACOS_AMD64 ?= $(CC)
MACOS_AMD64_MIN ?= 10.5
ifeq ($(HOST_ARCHNAME),ppc32be) ifeq ($(HOST_ARCHNAME),ppc32be)
CC_PPC32BE ?= $(CC) CC_PPC32BE ?= $(CC)
else else
@@ -153,7 +154,7 @@ $(DIST)/fossmark-macos-arm64: $(DRIVER) $(ASM_ARM64) | $(DIST)
@echo "built $@" @echo "built $@"
$(DIST)/fossmark-macos-amd64: $(DRIVER) $(ASM_AMD64) | $(DIST) $(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 $@" @echo "built $@"
# When the host is Linux/ARM64 or Linux/AMD64, the native binary IS one of the # When the host is Linux/ARM64 or Linux/AMD64, the native binary IS one of the
+5
View File
@@ -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 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. 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`: Run the benchmark with extra per-test details by passing `--verbose`:
```sh ```sh
+14 -1
View File
@@ -35,13 +35,14 @@
#if defined(__APPLE__) #if defined(__APPLE__)
# include <sys/types.h> # include <sys/types.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
# include <mach/mach_time.h>
#endif #endif
/* Change this at build time with -DFM_API_BASE_URL=\"https://host\". */ /* Change this at build time with -DFM_API_BASE_URL=\"https://host\". */
#ifndef FM_API_BASE_URL #ifndef FM_API_BASE_URL
# define FM_API_BASE_URL "https://fossbench.net" # define FM_API_BASE_URL "https://fossbench.net"
#endif #endif
#define FM_VERSION "0.1.3-hotfix1" #define FM_VERSION "0.1.3-hotfix2"
/* ---------- platform identification (for the banner only) ---------- */ /* ---------- platform identification (for the banner only) ---------- */
@@ -94,6 +95,18 @@ static double now_seconds(void)
QueryPerformanceCounter(&t); QueryPerformanceCounter(&t);
return (double)t.QuadPart / (double)f.QuadPart; 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 #else
# include <time.h> # include <time.h>
static double now_seconds(void) static double now_seconds(void)