Fix linker invocation on macOS Sequoia

This commit is contained in:
Itms
2025-08-09 08:51:55 +02:00
parent 758229558e
commit 7fde47e1f3
3 changed files with 20 additions and 3 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ cd "$(dirname "$0")"
PV=128.13.0
FOLDER="mozjs-${PV}"
# If same-version changes are needed, increment this.
LIB_VERSION="${PV}+wfg1"
LIB_VERSION="${PV}+wfg2"
LIB_NAME="mozjs128"
build_archive()
@@ -1,5 +1,4 @@
diff --git a/build/moz.configure/pkg.configure b/build/moz.configure/pkg.configure
index 418331b87..65a20b17b 100644
--- a/build/moz.configure/pkg.configure
+++ b/build/moz.configure/pkg.configure
@@ -12,7 +12,7 @@ def pkg_config(prefixes):
@@ -12,7 +11,6 @@ index 418331b87..65a20b17b 100644
pkg_config = check_prog(
diff --git a/build/moz.configure/toolchain.configure b/build/moz.configure/toolchain.configure
index 264027e57..e1b3cfabd 100644
--- a/build/moz.configure/toolchain.configure
+++ b/build/moz.configure/toolchain.configure
@@ -100,7 +100,7 @@ with only_when(host_is_osx | target_is_osx):
@@ -33,3 +31,21 @@ index 264027e57..e1b3cfabd 100644
cmd_base = c_compiler.wrapper + [c_compiler.compiler] + c_compiler.flags
def try_linker(linker):
@@ -1906,7 +1906,16 @@ def select_linker_tmpl(host_or_target):
kind = "ld64"
elif retcode != 0:
- return None
+ # macOS 15 fallback: try `-Wl,-v` if --version failed
+ if target.kernel == "Darwin":
+ fallback_cmd = cmd_base + linker_flag + ["-Wl,-v"]
+ retcode2, stdout2, stderr2 = get_cmd_output(*fallback_cmd, env=env)
+ if retcode2 == 0 and "@(#)PROGRAM:ld" in stderr2:
+ kind = "ld64"
+ else:
+ return None
+ else:
+ return None
elif "mold" in stdout:
kind = "mold"
@@ -36,6 +36,7 @@ fi
# - Allow use of pkg-config to use the same zlib for SM and pyrogenesis (https://bugzilla.mozilla.org/show_bug.cgi?id=1783570)
# - Force allowing build with older macOS SDK
# - Fix invocation of recent compiler (https://bugzilla.mozilla.org/show_bug.cgi?id=1844694)
# - Fix linker selection on macOS 15 (https://bugzilla.mozilla.org/show_bug.cgi?id=1964280)
if [ "${OS}" = "Darwin" ]; then
patch -p1 <"${PATCHES}"/FixMacOSBuild.diff
fi