[PATCH] D131792: [libunwind] Remove __ANDROID_API__ < 18 workaround
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Aug 12 10:25:50 PDT 2022
MaskRay created this revision.
MaskRay added reviewers: libunwind, danalbert, rprichard, srhines.
Herald added subscribers: libcxx-commits, danielkiss, StephenFan, krytarowski.
Herald added projects: libunwind, All.
Herald added 1 blocking reviewer(s): libunwind.
MaskRay requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
https://github.com/android/ndk/wiki/Changelog-r24 shows that the NDK has
moved forward to at least a minimum target API of 19. Remove old workaround.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D131792
Files:
libunwind/src/AddressSpace.hpp
Index: libunwind/src/AddressSpace.hpp
===================================================================
--- libunwind/src/AddressSpace.hpp
+++ libunwind/src/AddressSpace.hpp
@@ -373,28 +373,6 @@
typedef ElfW(Addr) Elf_Addr;
#endif
-static Elf_Addr calculateImageBase(struct dl_phdr_info *pinfo) {
- Elf_Addr image_base = pinfo->dlpi_addr;
-#if defined(__ANDROID__) && __ANDROID_API__ < 18
- if (image_base == 0) {
- // Normally, an image base of 0 indicates a non-PIE executable. On
- // versions of Android prior to API 18, the dynamic linker reported a
- // dlpi_addr of 0 for PIE executables. Compute the true image base
- // using the PT_PHDR segment.
- // See https://github.com/android/ndk/issues/505.
- for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) {
- const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i];
- if (phdr->p_type == PT_PHDR) {
- image_base = reinterpret_cast<Elf_Addr>(pinfo->dlpi_phdr) -
- phdr->p_vaddr;
- break;
- }
- }
- }
-#endif
- return image_base;
-}
-
struct _LIBUNWIND_HIDDEN dl_iterate_cb_data {
LocalAddressSpace *addressSpace;
UnwindInfoSections *sects;
@@ -468,7 +446,7 @@
(void)pinfo_size;
#endif
- Elf_Addr image_base = calculateImageBase(pinfo);
+ Elf_Addr image_base = pinfo->dlpi_addr;
// Most shared objects seen in this callback function likely don't contain the
// target address, so optimize for that. Scan for a matching PT_LOAD segment
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131792.452222.patch
Type: text/x-patch
Size: 1469 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220812/99037670/attachment.bin>
More information about the llvm-commits
mailing list