This is an archive of the discontinued LLVM Phabricator instance.

[X86] Add explicit library dependency on LLVMInstrumentation
ClosedPublic

Authored by myhsu on Aug 24 2021, 1:46 PM.

Details

Summary

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.

Diff Detail

Event Timeline

myhsu created this revision.Aug 24 2021, 1:46 PM
myhsu requested review of this revision.Aug 24 2021, 1:46 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 24 2021, 1:46 PM
kstoimenov accepted this revision.Aug 24 2021, 1:47 PM

Thanks for fixing this!

This revision is now accepted and ready to land.Aug 24 2021, 1:47 PM
This revision was landed with ongoing or failed builds.Aug 24 2021, 2:09 PM
This revision was automatically updated to reflect the committed changes.
myhsu added a comment.Aug 24 2021, 2:14 PM

FYI: this also fixed this green dragon failure