diff --git a/devel/valgrind/Portfile b/devel/valgrind/Portfile index c43cee0045a..5ab889ce226 100644 --- a/devel/valgrind/Portfile +++ b/devel/valgrind/Portfile @@ -95,10 +95,15 @@ if {$subport eq $name} { sha256 c91f3a2f7b02db0f3bc99479861656154d241d2fdb265614ba918cc6720a33ca \ size 16262776 } else { - version 3.27.0 - checksums rmd160 9a80964de2145941d24a6aa68587f865cd84441f \ - sha256 5b5937de8257ee8f51698ea71b9711adce98061aa07daa4a685efc3af9215bef \ - size 17294027 + version 3.27.1 + checksums rmd160 6ebfaca6297ce2b46854c32379db2a21d46c7e2d \ + sha256 5d589152eb8071c02feab8ce6ab719e431a1fbc3e2b1700f5432632a8b9264dc \ + size 17372682 + + # patches for older macOS versions + if {${os.platform} eq "darwin" && ${os.major} < 19} { + patchfiles-append legacymacos.diff readbootstrap.diff + } } conflicts valgrind-devel valgrind-macos-devel @@ -125,9 +130,14 @@ subport valgrind-devel { supported_archs i386 x86_64 epoch 1 - set date 2026-04-22 - version 3.27.0-r${date} - git.branch b62544e78b037b9a786814d047f41faf5f523e8d + set date 2026-05-20 + version 3.28.0-r${date} + git.branch c651c83f24cc8be21386f019dfd75e9bb04351bc + + # patch for older macOS versions + if {${os.platform} eq "darwin" && ${os.major} < 13} { + patchfiles-append readbootstrap.diff + } conflicts valgrind valgrind-macos-devel fetch.type git @@ -154,18 +164,15 @@ subport valgrind-macos-devel { } supported_archs i386 x86_64 arm64 - set date 2026-05-11 - version 3.27.0-r${date} - git.branch 0c21e45517ace6d9d5911a85f1e0d751fe88e964 + set date 2026-05-20 + version 3.28.0-r${date} + git.branch 472bff07019119605b1f85deaf3601a59f08d22e description A powerful memory debugger with latest macOS support (experimental) - # work around linker assertion failure with Xcode 15+ on macOS 14 - # ld: Assertion failed: (((Header*)(fileOutputBuffer))->hasMachOMagic()), - # function writeFixupsLinkEditContent, file Layout.cpp, line 809. - # https://developer.apple.com/documentation/xcode-release-notes/xcode-15-release-notes#Linking - if {${os.platform} eq "darwin" && ${os.major} == 23} { - patchfiles-append ldclassic-macos14.diff + # patches for older macOS versions + if {${os.platform} eq "darwin" && ${os.major} < 19} { + patchfiles-append legacymacos.diff readbootstrap.diff } conflicts valgrind valgrind-devel diff --git a/devel/valgrind/files/ldclassic-macos14.diff b/devel/valgrind/files/ldclassic-macos14.diff deleted file mode 100644 index d71e016ed2d..00000000000 --- a/devel/valgrind/files/ldclassic-macos14.diff +++ /dev/null @@ -1,12 +0,0 @@ -diff -rupN ../valgrind-orig/coregrind/link_tool_exe_darwin.in ./coregrind/link_tool_exe_darwin.in ---- ../valgrind-orig/coregrind/link_tool_exe_darwin.in -+++ ./coregrind/link_tool_exe_darwin.in -@@ -163,7 +163,7 @@ if ($archstr eq "arm64") { - - # Xcode 16 is completely borked and crashes when you use -segaddr so we rollback to - # the old linker in the meantime --if (@DARWIN_VERS@ >= 150000) { -+if (@DARWIN_VERS@ >= 140000) { - $cmd = "$cmd -ld_classic"; - - # If we're building with clang (viz, the C compiler as specified diff --git a/devel/valgrind/files/legacymacos.diff b/devel/valgrind/files/legacymacos.diff new file mode 100644 index 00000000000..d58937d3c2d --- /dev/null +++ b/devel/valgrind/files/legacymacos.diff @@ -0,0 +1,174 @@ +# Upstream fixes from Paul Floyd for building on older macOS: +# 9c57ad911908 (except configure.ac, for OS X < 10.10) +# Darwin: make sure that VKI_AT_FDCWD is defined on old systems +# 5a5454d1cb31 (for OS X < 10.11) +# Darwin syswrap: make kdebug_trace_string helpers conditional +# 739409674939 (for OS X < 10.11) +# Darwin persona syscall: use the SYS_persona macro to detect at build time +# dd0b3ac67b10 (for OS X 10.11) +# Darwin syswrap: move PRE(mach_voucher_extract_attr_recipe_trap) +# efc856293324, 57e4c8991f6e (for macOS 10.14) +# Darwin fixup_macho_loadcmds: make build more flexible +# +diff -rupN coregrind/fixup_macho_loadcmds.c coregrind/fixup_macho_loadcmds.c +--- coregrind/fixup_macho_loadcmds.c ++++ coregrind/fixup_macho_loadcmds.c +@@ -515,10 +515,13 @@ void modify_macho_loadcmds ( HChar* filename, + fail("has __UNIXSTACK, but wrong ::vmaddr"); + if (seg->vmsize != expected_stack_size) + fail("has __UNIXSTACK, but wrong ::vmsize"); +-#if SDK_VERS >= SDK_10_14_6 ++#if DARWIN_VERS >= DARWIN_10_15 + if (seg->maxprot != 3) + fail("has __UNIXSTACK, but wrong ::maxprot (should be 3)"); +-#else ++#elif DARWIN_VERS == DARWIN_10_14 ++ if (seg->maxprot != 7 && seg->maxprot != 3) ++ fail("has __UNIXSTACK, but wrong ::maxprot (should be 3 or 7)"); ++#else // <= DARWIN_10_13 + if (seg->maxprot != 7) + fail("has __UNIXSTACK, but wrong ::maxprot (should be 7)"); + #endif +diff -rupN coregrind/m_syswrap/priv_syswrap-darwin.h coregrind/m_syswrap/priv_syswrap-darwin.h +--- coregrind/m_syswrap/priv_syswrap-darwin.h ++++ coregrind/m_syswrap/priv_syswrap-darwin.h +@@ -31,6 +31,7 @@ + + #include "pub_core_basics.h" // ThreadId + #include "priv_types_n_macros.h" // DECL_TEMPLATE ++#include + + // syswrap-darwin.c + Addr allocstack ( ThreadId tid ); +diff -rupN coregrind/m_syswrap/syswrap-darwin.c coregrind/m_syswrap/syswrap-darwin.c +--- coregrind/m_syswrap/syswrap-darwin.c ++++ coregrind/m_syswrap/syswrap-darwin.c +@@ -721,6 +721,8 @@ void VG_(show_open_ports)(void) + VG_(message)(Vg_UserMsg, "\n"); + } + ++/* helpers used by PRE(kdebug_trace_string) added in OSX 10.11 */ ++#if DARWIN_VERS >= DARWIN_10_11 + + /* --------------------------------------------------------------------- + kdebug helpers +@@ -904,6 +906,8 @@ static const HChar *kdebug_debugid(ULong did) + return buf; + } + ++#endif ++ + + /* --------------------------------------------------------------------- + sync_mappings +@@ -8867,6 +8871,17 @@ PRE(mach_msg_thread) + } + } + ++// MACH 72 ++// kern_return_t mach_voucher_extract_attr_recipe(ipc_voucher_t voucher, ++// mach_voucher_attr_key_t key, ++// mach_voucher_attr_raw_recipe_t raw_recipe, ++// mach_voucher_attr_raw_recipe_size_t *in_out_size) ++PRE(mach_voucher_extract_attr_recipe_trap) ++{ ++ PRINT("mach_voucher_extract_attr_recipe(voucher:%#lx, key:%lu, raw_recipe:%#lx, in_out_size:%#lx)", ARG1, ARG2, ARG3, ARG4); ++ // FIXME PJF add MEM READ/WRITE and POST as needed ++} ++ + + static int is_thread_port(mach_port_t port) + { +@@ -10819,6 +10834,7 @@ PRE(pselect) + + #endif /* DARWIN_VERS >= DARWIN_10_11 */ + ++#if defined(SYS_persona) + // SYS_persona 494 + // __persona(uint32_t operation, uint32_t flags, struct kpersona_info *info, uid_t *id, + // i size_t *idlen, char *path); +@@ -10910,6 +10926,7 @@ POST(persona) + break; + } + } ++#endif /* defined(SYS_persona) */ + + + /* --------------------------------------------------------------------- +@@ -11168,17 +11185,6 @@ POST(host_create_mach_voucher_trap) + POST_MEM_WRITE( ARG4, sizeof(mach_port_name_t) ); + } + +-// MACH 72 +-// kern_return_t mach_voucher_extract_attr_recipe(ipc_voucher_t voucher, +-// mach_voucher_attr_key_t key, +-// mach_voucher_attr_raw_recipe_t raw_recipe, +-// mach_voucher_attr_raw_recipe_size_t *in_out_size) +-PRE(mach_voucher_extract_attr_recipe_trap) +-{ +- PRINT("mach_voucher_extract_attr_recipe(voucher:%#lx, key:%lu, raw_recipe:%#lx, in_out_size:%#lx)", ARG1, ARG2, ARG3, ARG4); +- // FIXME PJF add MEM READ/WRITE and POST as needed +-} +- + PRE(task_register_dyld_image_infos) + { + //#pragma pack(4) +@@ -12208,7 +12214,11 @@ const SyscallTableEntry ML_(syscall_table)[] = { + // _____(__NR_stack_snapshot_with_config), // 491 + // _____(__NR_microstackshot), // 492 + // _____(__NR_grab_pgo_data), // 493 ++#endif ++#if defined(SYS_persona) + MACXY(__NR_persona, persona), // 494 ++#endif ++#if DARWIN_VERS >= DARWIN_10_11 + _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(495)), // ??? + _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(496)), // ??? + _____(VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(497)), // ??? +diff -rupN include/vki/vki-darwin.h include/vki/vki-darwin.h +--- include/vki/vki-darwin.h ++++ include/vki/vki-darwin.h +@@ -373,7 +373,15 @@ typedef uint32_t vki_u32; + #define VKI_O_EXCL O_EXCL + #define VKI_O_EVTONLY O_EVTONLY + ++/* OSX 10.6 was the first to get any *at functions like openat ++ * but it wasn't until OSX 10.10 that a definition for AT_FDCWD ++ * was added. We dont claim to support anything older than 10.8 ++ * any more, so no need to worry about versions older than that. */ ++#if DARWIN_VERS >= DARWIN_10_10 + #define VKI_AT_FDCWD AT_FDCWD ++#else ++#define VKI_AT_FDCWD -2 ++#endif + + #define VKI_F_DUPFD F_DUPFD + #define VKI_F_GETFD F_GETFD +diff -rupN include/vki/vki-scnums-darwin.h include/vki/vki-scnums-darwin.h +--- include/vki/vki-scnums-darwin.h ++++ include/vki/vki-scnums-darwin.h +@@ -32,6 +32,7 @@ + + // need DARWIN_10_x definitions + #include "config.h" ++#include + + // osfmk/mach/i386/syscall_sw.h + +@@ -819,11 +820,15 @@ + #define __NR_stack_snapshot_with_config VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(491) + #define __NR_microstackshot VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(492) + #define __NR_grab_pgo_data VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(493) +-#define __NR_persona VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(494) ++#endif /* DARWIN_VERS >= DARWIN_10_11 */ ++#if defined(SYS_persona) ++#define __NR_persona VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(SYS_persona) // 494 ++#endif + /* 495 */ + /* 496 */ + /* 497 */ + /* 498 */ ++#if DARWIN_VERS >= DARWIN_10_11 + #define __NR_work_interval_ctl VG_DARWIN_SYSCALL_CONSTRUCT_UNIX(499) + #endif /* DARWIN_VERS >= DARWIN_10_11 */ + diff --git a/devel/valgrind/files/readbootstrap.diff b/devel/valgrind/files/readbootstrap.diff new file mode 100644 index 00000000000..95f30292895 --- /dev/null +++ b/devel/valgrind/files/readbootstrap.diff @@ -0,0 +1,21 @@ +diff -rupN coregrind/m_syswrap/syswrap-darwin.c coregrind/m_syswrap/syswrap-darwin.c +--- coregrind/m_syswrap/syswrap-darwin.c ++++ coregrind/m_syswrap/syswrap-darwin.c +@@ -1772,7 +1772,7 @@ static const HChar *name_for_fcntl(UWord cmd) { + F(F_PREALLOCATE); + F(F_SETSIZE); + F(F_RDADVISE); +-# if DARWIN_VERS < DARWIN_10_9 ++# if DARWIN_VERS < DARWIN_10_9 && defined(F_READBOOTSTRAP) + F(F_READBOOTSTRAP); + F(F_WRITEBOOTSTRAP); + # endif +@@ -1902,7 +1902,7 @@ PRE(fcntl) + } + break; + +-# if DARWIN_VERS < DARWIN_10_9 ++# if DARWIN_VERS < DARWIN_10_9 && defined(F_READBOOTSTRAP) + // struct fbootstraptransfer + case VKI_F_READBOOTSTRAP: + case VKI_F_WRITEBOOTSTRAP: