From b934d41e4ed638c729b93cd77dda266db89b36aa Mon Sep 17 00:00:00 2001 From: "Kirill A. Korinsky" Date: Wed, 13 Dec 2023 22:17:16 +0100 Subject: [PATCH] Use getsectiondata instead of getsectbynamefromheader since OS X 10.7 (fix of commit 0a6e4c335) Issue #514 (bdwgc). * dyn_load.c [DARWIN && !USE_GETSECTBYNAME]: Do not check USE_GETSECTIONDATA; change MAC_OS_X_VERSION_MAX_ALLOWED<=120000 to MAC_OS_X_VERSION_MIN_REQUIRED<1070; update comment. Co-authored-by: Ivan Maidanski --- dyn_load.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/dyn_load.c b/dyn_load.c index 301333f06..4470477e0 100644 --- a/dyn_load.c +++ b/dyn_load.c @@ -1314,12 +1314,10 @@ STATIC const char *GC_dyld_name_for_hdr(const struct GC_MACH_HEADER *hdr) } /* getsectbynamefromheader is deprecated (first time in macOS 13.0), */ -/* getsectiondata (introduced in macOS 10.7) is used instead to avoid */ -/* a warning about the deprecated symbol, at least. */ -/* Define USE_GETSECTBYNAME or USE_GETSECTIONDATA to control which */ -/* symbol to use manually, if needed. */ -#if !defined(USE_GETSECTBYNAME) && !defined(USE_GETSECTIONDATA) \ - && (MAC_OS_X_VERSION_MAX_ALLOWED <= 120000 /*MAC_OS_X_VERSION_12_0*/) +/* getsectiondata (introduced in macOS 10.7) is used instead if exists. */ +/* Define USE_GETSECTBYNAME to use the deprecated symbol, if needed. */ +#if !defined(USE_GETSECTBYNAME) \ + && (MAC_OS_X_VERSION_MIN_REQUIRED < 1070 /*MAC_OS_X_VERSION_10_7*/) # define USE_GETSECTBYNAME #endif