[PATCH] D127393: [Driver] Don't add -lresolv on FreeBSD

Andrew Turner via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jun 9 04:00:48 PDT 2022


andrew created this revision.
andrew added reviewers: kda, vitalybuka, eugenis, MaskRay.
Herald added subscribers: StephenFan, krytarowski, arichardson, emaste.
Herald added a project: All.
andrew requested review of this revision.
Herald added a project: clang.
Herald added a subscriber: cfe-commits.

There is no libresolv on FreeBSD. This fixes the sanitizers on
FreeBSD after https://reviews.llvm.org/D127145


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D127393

Files:
  clang/lib/Driver/ToolChains/CommonArgs.cpp
  clang/test/Driver/sanitizer-ld.c


Index: clang/test/Driver/sanitizer-ld.c
===================================================================
--- clang/test/Driver/sanitizer-ld.c
+++ clang/test/Driver/sanitizer-ld.c
@@ -107,7 +107,6 @@
 // CHECK-ASAN-FREEBSD: "--export-dynamic"
 // CHECK-ASAN-FREEBSD: "-lpthread"
 // CHECK-ASAN-FREEBSD: "-lrt"
-// CHECK-ASAN-FREEBSD: "-lresolv"
 
 // RUN: %clang -### %s 2>&1 \
 // RUN:     --target=i386-unknown-freebsd -fuse-ld=ld -fsanitize=address \
Index: clang/lib/Driver/ToolChains/CommonArgs.cpp
===================================================================
--- clang/lib/Driver/ToolChains/CommonArgs.cpp
+++ clang/lib/Driver/ToolChains/CommonArgs.cpp
@@ -839,7 +839,7 @@
       TC.getTriple().isOSOpenBSD())
     CmdArgs.push_back("-lexecinfo");
   // There is no libresolv on Android.
-  if (!TC.getTriple().isAndroid())
+  if (!TC.getTriple().isAndroid() && !TC.getTriple().isOSFreeBSD())
     CmdArgs.push_back("-lresolv");
 }
 


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127393.435492.patch
Type: text/x-patch
Size: 949 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220609/ba8a7692/attachment-0001.bin>


More information about the cfe-commits mailing list