valgrind-macos icon indicating copy to clipboard operation
valgrind-macos copied to clipboard

macOS 10.13 misdetects 32 bit as unsupported

Open paulfloyd opened this issue 1 month ago • 2 comments

In configure.ac this bit

     x86-darwin|amd64-darwin|arm64-darwin)
        AC_MSG_CHECKING([for 32 bit build support])
        # Currently, we assume nothing is 32bit only as all versions which are, are unsupported
        # Full breakdown:
        # iOS 6 and earlier and macOS 10.3 and earlier are 32bit only
        # iOS 7-10 and macOS 10.5-10.15 support both
        # iOS 11+ and macOS 10.15 are 64bit only
        vg_cv_only32bit="no"
        if test x$sdkversion = x10.14.6 -o $SDK_VERS -ge $SDK_10_15 ; then
            vg_cv_only64bit="yes"
            AC_MSG_RESULT([no])
        elif test $darwin_platform = iphoneos -a $SDK_VERS -ge $SDK_10_13; then
            vg_cv_only64bit="yes"
            AC_MSG_RESULT([no])
        else
            AC_MSG_RESULT([yes])
        fi

sets vg_cv_only64bit to yes in the first if branch, which is incorrect. If I comment out the vg_cv_only64bit="yes" then I get

m_mach/dyld_cache.c:94:2: error: "unknown architecture" #error "unknown architecture" ^ m_mach/dyld_cache.c:214:5: warning: no previous prototype for function 'ensure_init' [-Wmissing-prototypes] int ensure_init(void) { ^ 1 warning and 1 error generated.

paulfloyd avatar Nov 30 '25 07:11 paulfloyd

The latter seems easy to fix (https://github.com/LouisBrunner/valgrind-macos/blob/main/coregrind/m_mach/dyld_cache.c#L33, it's been 5y+ since the last 32-bit compatible macOS, didn't think about that) but no idea for the former.

What's your SDK version? (xcrun --sdk $darwin_sdk --show-sdk-version)

LouisBrunner avatar Nov 30 '25 17:11 LouisBrunner

SDK is 10.14

x86 works surprisingly well. I get a few failures due to unsupported opcodes

paulfloyd avatar Nov 30 '25 17:11 paulfloyd

This is now fixed upstream.

I just needed to add amd64-darwin to the list below

case "$ARCH_MAX-$VGCONF_OS" in
     amd64-linux|ppc64be-linux|arm64-linux|amd64-solaris|amd64-darwin|amd64-freebsd)
        AC_MSG_CHECKING([for 32 bit build support])
        safe_CFLAGS=$CFLAGS
        CFLAGS="-m32"

paulfloyd avatar Dec 18 '25 14:12 paulfloyd

That's probably a simpler fix than what I did... Too bad we can't get rid of the SDK parsing in other places.

LouisBrunner avatar Dec 19 '25 18:12 LouisBrunner