[clang] [clang][driver] Correcting arguments when using `libFuzzer` with `-shared-libsan` (PR #164842)
Dan Blackwell via cfe-commits
cfe-commits at lists.llvm.org
Mon Dec 1 08:16:37 PST 2025
=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>,
=?utf-8?q?Björn?= Svensson <bjorn.a.svensson at est.tech>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/164842 at github.com>
================
@@ -43,6 +43,12 @@
// RUN: %clang -fsanitize=fuzzer --target=i386-unknown-linux -stdlib=libc++ -static-libstdc++ %s -### 2>&1 | FileCheck --check-prefixes=CHECK-LIBCXX-STATIC %s
// CHECK-LIBCXX-STATIC: "-Bstatic" "-lc++"
+// Check that we add required sanitizer dependencies when dynamically linking
+// the sanitizer runtime (e.g. libFuzzer uses ceilf in libm).
----------------
DanBlackwell wrote:
So from a bit of digging, it seems that if building with coverage then UBSan gets added: https://github.com/llvm/llvm-project/blob/46c34bec134be0cb606fba1affbc70920b4fc266/clang/lib/Driver/SanitizerArgs.cpp#L366
which is a static runtime, and thus triggers linking the necessary libraries. I guess that adding `-shared-libsan` means you're back to having no static libs, and then no dependencies get linked.
https://github.com/llvm/llvm-project/pull/164842
More information about the cfe-commits
mailing list