Patch 9588b685c6b2 introduced dependency on ASAN. But it didn't explicitly put LLVMInstrumentation as one of the library dependencies such that the build will fail if we're building LLVM as shared libraries (i.e. -DBUILD_SHARED_LIBS=ON). Here are the error messages:
ld.lld: error: undefined symbol: llvm::ASanAccessInfo::ASanAccessInfo(int) >>> referenced by X86MCInstLower.cpp:1337 (/home/rem/repos/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1337) >>> lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86MCInstLower.cpp.o:(llvm::X86AsmPrinter::LowerASAN_CHECK_MEMACCESS(llvm::MachineInstr const&)) >>> referenced by X86MCInstLower.cpp:1555 (/home/rem/repos/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1555) >>> lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86MCInstLower.cpp.o:(llvm::X86AsmPrinter::emitAsanMemaccessSymbols(llvm::Module&)) ld.lld: error: undefined symbol: llvm::getAddressSanitizerParams(llvm::Triple const&, int, bool, unsigned long*, int*, bool*) >>> referenced by X86MCInstLower.cpp:1363 (/home/rem/repos/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1363) >>> lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86MCInstLower.cpp.o:(llvm::X86AsmPrinter::emitAsanMemaccessPartial(llvm::Module&, unsigned int, llvm::ASanAccessInfo const&, llvm::MCSubtargetInfo&)) >>> referenced by X86MCInstLower.cpp:1464 (/home/rem/repos/llvm-project/llvm/lib/Target/X86/X86MCInstLower.cpp:1464) >>> lib/Target/X86/CMakeFiles/LLVMX86CodeGen.dir/X86MCInstLower.cpp.o:(llvm::X86AsmPrinter::emitAsanMemaccessFull(llvm::Module&, unsigned int, llvm::ASanAccessInfo const&, llvm::MCSubtargetInfo&))
This patch explicitly links X86CodeGen against the Instrumentation component.