[PATCH] D127145: [Driver] add -lresolv for all but Android.

Kevin Athey via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Jun 6 13:14:57 PDT 2022


kda created this revision.
kda added reviewers: vitalybuka, eugenis.
Herald added subscribers: Enna1, danielkiss.
Herald added a project: All.
kda requested review of this revision.
Herald added subscribers: Sanitizers, cfe-commits, MaskRay.
Herald added projects: clang, Sanitizers.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127145

Files:
  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


Index: compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Linux/dn_expand.cpp
+++ 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>
Index: compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Linux/b64.cpp
+++ 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>
Index: compiler-rt/test/msan/Linux/dn_expand.cpp
===================================================================
--- compiler-rt/test/msan/Linux/dn_expand.cpp
+++ 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>
Index: compiler-rt/test/msan/Linux/b64.cpp
===================================================================
--- compiler-rt/test/msan/Linux/b64.cpp
+++ 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
 
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -838,6 +838,10 @@
       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


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127145.434574.patch
Type: text/x-patch
Size: 2269 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220606/afb2bfc2/attachment.bin>


More information about the cfe-commits mailing list