diff options
author | Kostya Kortchinsky <kostyak@google.com> | 2018-06-26 16:14:35 +0000 |
---|---|---|
committer | Kostya Kortchinsky <kostyak@google.com> | 2018-06-26 16:14:35 +0000 |
commit | f3b1b3173bf29177153759ffc6b858adefca26fe (patch) | |
tree | b3ddc2a64db3e195b676a49953f1bbd1a3b5ad6d /lib/Driver/ToolChains/CommonArgs.cpp | |
parent | 3e914648ae0f8adb2ae0cd147b5967251f57fd19 (diff) | |
download | clang-f3b1b3173bf29177153759ffc6b858adefca26fe.tar.gz |
[Driver] Do not add -lpthread & -lrt with -static-libsan on Android
Summary:
I am not sure anyone has tried to compile an application with sanitizers on
Android with `-static-libsan`, and a recent NDK, but it fails with:
```
.../i686-linux-android/bin/ld.gold: error: cannot find -lpthread
.../i686-linux-android/bin/ld.gold: error: cannot find -lrt
```
My understanding is that both are included in Bionic and as such are not needed,
and actually error out.
So remove the addition of those two in `linkSanitizerRuntimeDeps` when dealing
with Android, and update the tests.
I am unfamiliar with the evolution of the NDK and I am not sure if this has
always been the case or if this is somewhat of a recent evolution. I'll let
Android people chime in.
Reviewers: eugenis, pirama, srhines
Reviewed By: eugenis, srhines
Subscribers: cfe-commits
Differential Revision: https://reviews.llvm.org/D48570
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@335620 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Driver/ToolChains/CommonArgs.cpp')
-rw-r--r-- | lib/Driver/ToolChains/CommonArgs.cpp | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/Driver/ToolChains/CommonArgs.cpp b/lib/Driver/ToolChains/CommonArgs.cpp index 98a36bcd83..1e093b25b9 100644 --- a/lib/Driver/ToolChains/CommonArgs.cpp +++ b/lib/Driver/ToolChains/CommonArgs.cpp @@ -564,8 +564,9 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC, // Force linking against the system libraries sanitizers depends on // (see PR15823 why this is necessary). CmdArgs.push_back("--no-as-needed"); - // There's no libpthread or librt on RTEMS. - if (TC.getTriple().getOS() != llvm::Triple::RTEMS) { + // There's no libpthread or librt on RTEMS & Android. + if (TC.getTriple().getOS() != llvm::Triple::RTEMS && + !TC.getTriple().isAndroid()) { CmdArgs.push_back("-lpthread"); if (TC.getTriple().getOS() != llvm::Triple::OpenBSD) CmdArgs.push_back("-lrt"); |