Skip to content

Commit

Permalink
Fix bad stack traces on Android devices when using LLD
Browse files Browse the repository at this point in the history
Issue: android/ndk#1196

This is a port of the fix from NDK master: https://android-review.googlesource.com/c/platform/ndk/+/1350672
Quoting description from the original fix:

> The unwinder used for crash handling on Android devices prior to API 29 cannot
> correctly unwind binaries built with `-Wl,--rosegment`. This flag is enabled by
> default when using LLD, so if using LLD and targeting devices older than API 29
> you must pass `-Wl,--no-rosegment` when linking for correct stack traces in logcat.

ref:3e66526bf1f6bd39b04f067de173c9ca090e5f13
  • Loading branch information
borman committed Oct 7, 2020
1 parent a711a29 commit 09fd7c4
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions build/ymake_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -1672,6 +1672,9 @@ def __init__(self, tc, build):
self.ld_flags.extend(['-ldl', '-lrt', '-Wl,--no-as-needed'])
elif target.is_android:
self.ld_flags.extend(['-ldl', '-Wl,--no-as-needed'])
if target.android_api < 29:
# https://github.com/android/ndk/issues/1196
self.ld_flags.append('-Wl,--no-rosegment')
elif target.is_macos:
self.ld_flags.append('-Wl,-no_deduplicate')
if not self.tc.is_clang:
Expand Down

0 comments on commit 09fd7c4

Please sign in to comment.