[clang] Add no-rosegment by default for API 29 and earlier. (PR #117611)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Nov 25 11:06:53 PST 2024
https://github.com/hiraditya created https://github.com/llvm/llvm-project/pull/117611
Details in: https://github.com/android/ndk/issues/1196
Fixes: https://github.com/android/ndk/issues/1294
>From 32cc67bbf00bde75fd1c681879106ae063363882 Mon Sep 17 00:00:00 2001
From: AdityaK <hiraditya at msn.com>
Date: Mon, 25 Nov 2024 11:05:53 -0800
Subject: [PATCH] Add no-rosegment by default for API 29 and earlier.
Details in: https://github.com/android/ndk/issues/1196
Fixes: https://github.com/android/ndk/issues/1294
---
clang/lib/Driver/ToolChains/Linux.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/clang/lib/Driver/ToolChains/Linux.cpp b/clang/lib/Driver/ToolChains/Linux.cpp
index d1cb625613415b..5cc3d6feaa434f 100644
--- a/clang/lib/Driver/ToolChains/Linux.cpp
+++ b/clang/lib/Driver/ToolChains/Linux.cpp
@@ -256,6 +256,14 @@ 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)) {
+ // 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
+ // enabled by default for LLD. Android only supports LLD, so it's not an
+ // issue that this flag is not accepted by other linkers.
+ ExtraOpts.push_back("--no-rosegment");
+ }
}
if (GCCInstallation.getParentLibPath().contains("opt/rh/"))
More information about the cfe-commits
mailing list