Skip to content

Commit 6dce56b

Browse files
committed
[Driver] add -lresolv for all but Android.
As there 3 intercepts that depend on libresolv, link tests in ./configure scripts may be confuse by the presence of resolv symbols (i.e. dn_expand) even with -lresolv and get a runtime error. Android provides the functionality in libc. https://reviews.llvm.org/D122849 https://reviews.llvm.org/D126851 Reviewed By: eugenis, MaskRay Differential Revision: https://reviews.llvm.org/D127145
1 parent 3bcaf2e commit 6dce56b

File tree

5 files changed

+7
-10
lines changed

5 files changed

+7
-10
lines changed

clang/lib/Driver/ToolChains/CommonArgs.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -838,6 +838,9 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC,
838838
TC.getTriple().isOSNetBSD() ||
839839
TC.getTriple().isOSOpenBSD())
840840
CmdArgs.push_back("-lexecinfo");
841+
// There is no libresolv on Android.
842+
if (!TC.getTriple().isAndroid())
843+
CmdArgs.push_back("-lresolv");
841844
}
842845

843846
static void

compiler-rt/test/msan/Linux/b64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_msan -O0 %s -o %t -lresolv && %run %t
1+
// RUN: %clangxx_msan -O0 %s -o %t && %run %t
22
// RUN: not %run %t NTOP_READ 2>&1 | FileCheck %s --check-prefix=NTOP_READ
33
// RUN: not %run %t PTON_READ 2>&1 | FileCheck %s --check-prefix=PTON_READ
44

compiler-rt/test/msan/Linux/dn_expand.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: %clangxx_msan -O0 %s -o %t -lresolv && %run %t
1+
// RUN: %clangxx_msan -O0 %s -o %t && %run %t
22

33
#include <assert.h>
44
#include <resolv.h>

compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// RUN: %clangxx %s -o %t -lresolv && %run %t %p
2-
3-
// -lresolv fails on Android.
4-
// UNSUPPORTED: android
1+
// RUN: %clangxx %s -o %t && %run %t %p
52

63
#include <assert.h>
74
#include <resolv.h>

compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
1-
// RUN: %clangxx %s -o %t -lresolv && %run %t %p
2-
3-
// -lresolv fails on Android.
4-
// UNSUPPORTED: android
1+
// RUN: %clangxx %s -o %t && %run %t %p
52

63
#include <assert.h>
74
#include <resolv.h>

0 commit comments

Comments
 (0)