[all-commits] [llvm/llvm-project] 91f8aa: [Android] Use -l:libunwind.a with --rtlib=compiler-rt
Ryan Prichard via All-commits
all-commits at lists.llvm.org
Thu Feb 25 15:40:32 PST 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 91f8aacc040f5a458cfc2a10c4039e0028931455
https://github.com/llvm/llvm-project/commit/91f8aacc040f5a458cfc2a10c4039e0028931455
Author: Ryan Prichard <rprichard at google.com>
Date: 2021-02-25 (Thu, 25 Feb 2021)
Changed paths:
M clang/lib/Driver/ToolChain.cpp
M clang/lib/Driver/ToolChains/CommonArgs.cpp
Log Message:
-----------
[Android] Use -l:libunwind.a with --rtlib=compiler-rt
On Android, the unwinder isn't part of the C++ STL and isn't (in older
versions) exported from libc.so. Instead, the driver links the static
unwinder archive implicitly. Currently, the Android NDK implicitly
links libgcc.a to provide both builtins and the unwinder.
To support switching to compiler-rt builtins and libunwind, make
--rtlib=compiler-rt behave the same way on Android, and implicitly pass
-l:libunwind.a to the linker.
Adjust the -ldl logic. For the Android NDK, the unwinder (whether
libgcc.a or libunwind.a) is linked statically and calls a function in
the dynamic loader for finding unwind tables (e.g. dl_iterate_phdr).
On Android, this function is in libc.a for static executables and
libdl.so otherwise, so -ldl is needed. (glibc doesn't need -ldl because
its libc.so exports dl_iterate_phdr.)
Differential Revision: https://reviews.llvm.org/D96403
More information about the All-commits
mailing list