Skip to content

Conversation

@hiraditya
Copy link
Collaborator

@hiraditya hiraditya commented Nov 25, 2024

Patch copied from android/ndk#1294 (comment)

Details in: android/ndk#1196
Fixes: android/ndk#1294

@hiraditya hiraditya requested a review from DanAlbert November 25, 2024 19:07
@llvmbot llvmbot added clang Clang issues not falling into any other category clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' labels Nov 25, 2024
@llvmbot
Copy link
Member

llvmbot commented Nov 25, 2024

@llvm/pr-subscribers-clang

@llvm/pr-subscribers-clang-driver

Author: AdityaK (hiraditya)

Changes

Details in: android/ndk#1196
Fixes: android/ndk#1294


Full diff: https://github.com/llvm/llvm-project/pull/117611.diff

1 Files Affected:

  • (modified) clang/lib/Driver/ToolChains/Linux.cpp (+8)
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/"))

@github-actions
Copy link

github-actions bot commented Dec 2, 2024

✅ With the latest revision this PR passed the C/C++ code formatter.

@hiraditya hiraditya closed this Dec 4, 2024
@hiraditya hiraditya deleted the rosegment branch December 4, 2024 21:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

clang:driver 'clang' and 'clang++' user-facing binaries. Not 'clang-cl' clang Clang issues not falling into any other category

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FR] disable rosegment in the driver once we no longer support bfd/gold

2 participants