[clang] 6dce56b - [Driver] add -lresolv for all but Android.
Kevin Athey via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 6 15:49:47 PDT 2022
Author: Kevin Athey
Date: 2022-06-06T15:49:42-07:00
New Revision: 6dce56b2a3082191aa3d26abd4f05cf518d98356
URL: https://github.com/llvm/llvm-project/commit/6dce56b2a3082191aa3d26abd4f05cf518d98356
DIFF: https://github.com/llvm/llvm-project/commit/6dce56b2a3082191aa3d26abd4f05cf518d98356.diff
LOG: [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
Added:
Modified:
clang/lib/Driver/ToolChains/CommonArgs.cpp
compiler-rt/test/msan/Linux/b64.cpp
compiler-rt/test/msan/Linux/dn_expand.cpp
compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp
index 7e9fa055b0bc2..db022d133d9dc 100644
--- a/clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ b/clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -838,6 +838,9 @@ void tools::linkSanitizerRuntimeDeps(const ToolChain &TC,
TC.getTriple().isOSNetBSD() ||
TC.getTriple().isOSOpenBSD())
CmdArgs.push_back("-lexecinfo");
+ // There is no libresolv on Android.
+ if (!TC.getTriple().isAndroid())
+ CmdArgs.push_back("-lresolv");
}
static void
diff --git a/compiler-rt/test/msan/Linux/b64.cpp b/compiler-rt/test/msan/Linux/b64.cpp
index 1eb72800af203..90a31db233c78 100644
--- a/compiler-rt/test/msan/Linux/b64.cpp
+++ b/compiler-rt/test/msan/Linux/b64.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -O0 %s -o %t -lresolv && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
// RUN: not %run %t NTOP_READ 2>&1 | FileCheck %s --check-prefix=NTOP_READ
// RUN: not %run %t PTON_READ 2>&1 | FileCheck %s --check-prefix=PTON_READ
diff --git a/compiler-rt/test/msan/Linux/dn_expand.cpp b/compiler-rt/test/msan/Linux/dn_expand.cpp
index 5c8458000227b..a7b2b37562edd 100644
--- a/compiler-rt/test/msan/Linux/dn_expand.cpp
+++ b/compiler-rt/test/msan/Linux/dn_expand.cpp
@@ -1,4 +1,4 @@
-// RUN: %clangxx_msan -O0 %s -o %t -lresolv && %run %t
+// RUN: %clangxx_msan -O0 %s -o %t && %run %t
#include <assert.h>
#include <resolv.h>
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
index 99f27421642cb..96fd0138648b3 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
@@ -1,7 +1,4 @@
-// RUN: %clangxx %s -o %t -lresolv && %run %t %p
-
-// -lresolv fails on Android.
-// UNSUPPORTED: android
+// RUN: %clangxx %s -o %t && %run %t %p
#include <assert.h>
#include <resolv.h>
diff --git a/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp b/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
index 9c256ad36191d..9a56f08c9763d 100644
--- a/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
+++ b/compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
@@ -1,7 +1,4 @@
-// RUN: %clangxx %s -o %t -lresolv && %run %t %p
-
-// -lresolv fails on Android.
-// UNSUPPORTED: android
+// RUN: %clangxx %s -o %t && %run %t %p
#include <assert.h>
#include <resolv.h>
More information about the cfe-commits
mailing list