diff --git a/clang/lib/Driver/ToolChains/CommonArgs.cpp b/clang/lib/Driver/ToolChains/CommonArgs.cpp --- a/clang/lib/Driver/ToolChains/CommonArgs.cpp +++ b/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"); } diff --git a/clang/test/Driver/sanitizer-ld.c b/clang/test/Driver/sanitizer-ld.c --- a/clang/test/Driver/sanitizer-ld.c +++ b/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 \