diff --git a/compiler-rt/test/asan/lit.cfg.py b/compiler-rt/test/asan/lit.cfg.py --- a/compiler-rt/test/asan/lit.cfg.py +++ b/compiler-rt/test/asan/lit.cfg.py @@ -91,9 +91,12 @@ asan_dynamic_flags = [] if config.asan_dynamic: asan_dynamic_flags = ["-shared-libasan"] - # On Windows, we need to simulate "clang-cl /MD" on the clang driver side. if platform.system() == 'Windows': + # On Windows, we need to simulate "clang-cl /MD" on the clang driver side. asan_dynamic_flags += ["-D_MT", "-D_DLL", "-Wl,-nodefaultlib:libcmt,-defaultlib:msvcrt,-defaultlib:oldnames"] + elif platform.system() == 'FreeBSD': + # On FreeBSD, we need to add -pthread to ensure pthread functions are available. + asan_dynamic_flags += ['-pthread'] config.available_features.add("asan-dynamic-runtime") else: config.available_features.add("asan-static-runtime")