[PATCH] D52104: lld-link: print demangled symbol names for "undefined symbol" diagnostics

Nico Weber via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 14 10:31:27 PDT 2018


thakis created this revision.
thakis added reviewers: ruiu, zturner.
Herald added subscribers: erik.pilkington, christof, hiraditya.

For this, add a few toString() calls when printing the "undefined symbol" diagnostics; toString() already does demangling on Windows hosts.

Also make lld::demangleMSVC() (called by toString(Symbol*)) call LLVM's microsoftDemangle() instead of UnDecorateSymbolName() so that it works on non-Windows hosts – this makes both updating tests easier and provides a better user experience for people doing cross-links.

Update microsoftDemangle() to work more like itaniumDemangle() after which appears to be modeled, so that lld::demangleItanium() and lld::demangleMSVC() can look alike:

- Use same method of initializing the output stream and its buffer
- Allow a nullptr Status pointer
- Don't print the mangled name on demangling error
- Write to N (if it is non-nullptr)

This doesn't yet do the right thing for symbols starting with __imp_, but that can be improved in a follow-up.


https://reviews.llvm.org/D52104

Files:
  libcxxabi/src/cxa_demangle.cpp
  libcxxabi/src/demangle/Utility.h
  lld/COFF/SymbolTable.cpp
  lld/Common/Strings.cpp
  lld/test/COFF/undefined-symbol-cv.s
  lld/test/COFF/undefined-symbol.s
  llvm/include/llvm/Demangle/Utility.h
  llvm/lib/Demangle/ItaniumDemangle.cpp
  llvm/lib/Demangle/MicrosoftDemangle.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D52104.165529.patch
Type: text/x-patch
Size: 13836 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180914/61ab3f80/attachment.bin>


More information about the llvm-commits mailing list