This is an archive of the discontinued LLVM Phabricator instance.

[CSKY] AsmBackend: Make Inst.dump() debug-only
ClosedPublic

Authored by kees on Mar 31 2022, 4:04 PM.

Details

Summary

Production builds of CSKY will fail to link with an bare call to
Inst.dump(), which was introduced in commit 582836faafcb:

ld.lld: error: undefined symbol: llvm::MCInst::dump() const

referenced by CSKYAsmBackend.cpp

/home/kees/src/built-compilers/llvm/stage2-prof-gen/lto.cache/llvmcache-0656FC38C728A7FE0F767D10CD84C7F820114C46:(llvm::CSKYAsmBackend::relaxInstruction(llvm::MCInst&, llvm::MCSubtargetInfo const&) const)

Wrap it in LLVM_DEBUG().

Fixes https://github.com/llvm/llvm-project/issues/54684

Diff Detail

Event Timeline

kees created this revision.Mar 31 2022, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 4:04 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
kees requested review of this revision.Mar 31 2022, 4:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 31 2022, 4:04 PM
kees added a reviewer: void.Mar 31 2022, 4:27 PM
MaskRay accepted this revision.Mar 31 2022, 5:03 PM
MaskRay added a subscriber: MaskRay.

s/production /-DLLVM_ENABLE_ASSERTIONS=OFF /

This revision is now accepted and ready to land.Mar 31 2022, 5:03 PM

Is CSKY target enabled as default in lld building even it's an experimental target?

MaskRay added a comment.EditedMar 31 2022, 11:24 PM

Is CSKY target enabled as default in lld building even it's an experimental target?

lld is irrelevant here. The gist here is that in -DLLVM_ENABLE_ASSERTIONS=OFF builds MCInst::dump is not defined. Any linker will report an error.

The description may not convey the idea clearly. I updated the commit message.

This revision was landed with ongoing or failed builds.Mar 31 2022, 11:27 PM
This revision was automatically updated to reflect the committed changes.