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

2022-06-06 Thread Kevin Athey via Phabricator via cfe-commits
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG6dce56b2a308: [Driver] add -lresolv for all but Android. 
(authored by kda).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

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 
 #include 
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 
 #include 
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 
 #include 
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,9 @@
   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


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 
 #include 
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 
 #include 
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 
 #include 
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,9 @@
   TC.getTriple().isOSNetBSD() ||
   TC.getTriple().isOSOpenBSD())
 CmdArgs.push_back("-lexecinfo");
+  // There is no libresolv on Android.
+  if (!TC.getTriple().isAndroid())
+CmdArgs.push_ba

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

2022-06-06 Thread Kevin Athey via Phabricator via cfe-commits
kda updated this revision to Diff 434634.
kda marked an inline comment as done.
kda added a comment.

removed braces on single statement from conditional


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

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 
 #include 
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 
 #include 
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 
 #include 
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,9 @@
   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


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 
 #include 
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 
 #include 
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 
 #include 
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,9 @@
   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
_

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

2022-06-06 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis accepted this revision.
eugenis added a comment.

Typo: "runttime"

LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Kevin Athey via Phabricator via cfe-commits
kda added a comment.

In D127145#3561519 , @eugenis wrote:

> The interceptor (dn_expand) is only defined on linux && !android, while this 
> code links libresolv on *bsd and others, too. I think it's ok, as long as all 
> platforms with the interceptor are covered.
>
> It would be great to mention the actual reason we do this in the commit 
> message: because otherwise link tests in ./configure scripts may be confused 
> by the presence of the dn_expand symbol even without -lresolv (because of the 
> interceptor) and get a runtime error later.

Updated summary.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Evgenii Stepanov via Phabricator via cfe-commits
eugenis added a comment.

The interceptor (dn_expand) is only defined on linux && !android, while this 
code links libresolv on *bsd and others, too. I think it's ok, as long as all 
platforms with the interceptor are covered.

It would be great to mention the actual reason we do this in the commit 
message: because otherwise link tests in ./configure scripts may be confused by 
the presence of the dn_expand symbol even without -lresolv (because of the 
interceptor) and get a runtime error later.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay accepted this revision.
MaskRay added inline comments.
This revision is now accepted and ready to land.
Herald added a subscriber: StephenFan.



Comment at: clang/lib/Driver/ToolChains/CommonArgs.cpp:843
+  if (!TC.getTriple().isAndroid()) {
+CmdArgs.push_back("-lresolv");
+  }

Omit brace for simple single-line body.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Vitaly Buka via Phabricator via cfe-commits
vitalybuka added a comment.

yes, however I have no idea if we need !TC.getTriple().isOSFreeBSD()
!TC.getTriple().isOSNetBSD() !TC.getTriple().isOSOpenBSD()) etc.
I guess if make mistake it will be noticed and fixed.

Please update clang/test/Driver/sanitizer-ld.c


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment.

The description needs to mention the motivation. Is this meant for `isOSLinux() 
&& isGNUEnvironment()` targets?


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127145/new/

https://reviews.llvm.org/D127145

___
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


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

2022-06-06 Thread Kevin Athey via Phabricator via cfe-commits
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 
 #include 
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 
 #include 
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 
 #include 
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


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 
 #include 
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 
 #include 
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 
 #include 
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_