commit ecec57301419e0660a58c103e25849b9f189bad0
parent 60f29a4985e8c2d43a17368735bd0ce303a9f364
Author: Mike Hommey <mh+mozilla@glandium.org>
Date: Tue, 21 Oct 2025 23:12:23 +0000
Bug 1994627 - Avoid adding the --no-rosegment flag when using BFD ld on Android. r=firefox-build-system-reviewers,ahochheiden
Differential Revision: https://phabricator.services.mozilla.com/D269305
Diffstat:
3 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/build/build-clang/clang-20.json b/build/build-clang/clang-20.json
@@ -13,6 +13,7 @@
"llvmorg-22-init-4745-gbe179d069664.patch",
"android-hardware-buffer-header-workaround.patch",
"arm64e-hack.patch",
+ "no-no-rosegment.patch",
"compiler-rt-rss-limit-heap-profile.patch",
"plugin-registry-symbols-llvm-pr-163391.patch"
]
diff --git a/build/build-clang/clang-trunk.json b/build/build-clang/clang-trunk.json
@@ -10,6 +10,7 @@
"revert-llvmorg-15-init-13446-g7524fe962e47.patch",
"android-hardware-buffer-header-workaround_clang_21.patch",
"arm64e-hack.patch",
+ "no-no-rosegment.patch",
"compiler-rt-rss-limit-heap-profile.patch",
"plugin-registry-symbols-llvm-pr-163391.patch"
]
diff --git a/build/build-clang/no-no-rosegment.patch b/build/build-clang/no-no-rosegment.patch
@@ -0,0 +1,18 @@
+Avoid adding the --no-rosegment flag when using BFD ld on Android, because versions
+prior to binutils 2.43 don't support it.
+
+diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
+index 0767fe6c5879..ced4fbf072a4 100644
+--- a/clang/lib/Driver/ToolChains/Linux.cpp
++++ b/clang/lib/Driver/ToolChains/Linux.cpp
+@@ -247,7 +247,9 @@ Linux::Linux(const Driver &D, const llvm::Triple &Triple, const ArgList &Args)
+ ExtraOpts.push_back("-z");
+ ExtraOpts.push_back("max-page-size=16384");
+ }
+- if (Triple.isAndroidVersionLT(29)) {
++ if (Triple.isAndroidVersionLT(29) &&
++ !Args.getLastArgValue(options::OPT_fuse_ld_EQ)
++ .starts_with_insensitive("bfd")) {
+ // https://github.com/android/ndk/issues/1196
+ // The unwinder used by the crash handler on versions of Android prior to
+ // API 29 did not correctly handle binaries built with rosegment, which is