[clang][Driver] Pass /INFERASANLIBS:NO to link.exe under -fsanitize=address
authorArthur Eubanks <aeubanks@google.com>
Thu, 23 Feb 2023 21:19:08 +0000 (13:19 -0800)
committerArthur Eubanks <aeubanks@google.com>
Fri, 24 Feb 2023 17:28:10 +0000 (09:28 -0800)
commitdc07867dc9991c982bd3441da19d6fcc16ea54d6
tree95df6505de94efcd04691a14dc1efc4c63baa104
parent53689fdfb29767a12b4d5ad41c67a705a3c622de
[clang][Driver] Pass /INFERASANLIBS:NO to link.exe under -fsanitize=address

With recent MSVC releases, STL headers will add /INFERASANLIBS to the drectve section of object files that are compiled with clang. With this flag, link.exe will automatically attempt to look for asan libs.

When using clang as the driver to invoke the linker, we want to disable this feature because we explicitly pass the proper asan libraries, otherwise we get symbols defined multiple times.

Reviewed By: hans

Differential Revision: https://reviews.llvm.org/D144684
clang/lib/Driver/ToolChains/MSVC.cpp
clang/test/Driver/cl-link.c