[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
This commit is contained in:
Kevin Athey
2022-06-06 15:43:00 -07:00
parent 3bcaf2eb93
commit 6dce56b2a3
5 changed files with 7 additions and 10 deletions

View File

@@ -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

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>