This is an archive of the discontinued LLVM Phabricator instance.

ld.lld: Demangle symbols from archives in diagnostics
ClosedPublic

Authored by thakis on Jul 22 2019, 8:24 AM.

Details

Summary

This ports r366573 from COFF to ELF.

There are now to toString(Archive::Symbol), one doing MSVC demangling
in COFF and one doing Itanium demangling in ELF, so rename these two
to toCOFFString() and to toELFString() to not get a duplicate symbol.

Nothing ever passes a raw Archive::Symbol to CHECK(), so these not
being part of the normal toString() machinery seems ok.

There are two code paths in the ELF linker that emits this type of
diagnostic:

  1. The "normal" one in InputFiles.cpp. This is covered by the tweaked test.
  1. An additional one that's only used for libcalls if there's at least one bitcode in the link, and if the libcall symbol is lazy, and lazily loaded from an archive (i.e. not from a lazy .o file). (This code path was added in r339301.) Since all libcall names so far are C symbols and never mangled, the change there is not observable and hence not covered by tests.

Diff Detail

Repository
rL LLVM

Event Timeline

thakis created this revision.Jul 22 2019, 8:24 AM
thakis marked an inline comment as done.Jul 22 2019, 8:24 AM
thakis added inline comments.
lld/ELF/Symbols.h
36 ↗(On Diff #211110)

This overload is also declared in InputFiles.h, and since its implementation is in InputFiles.cpp I removed this redundant declaration.

ruiu accepted this revision.Jul 23 2019, 11:39 AM

LGTM

lld/COFF/Symbols.h
26 ↗(On Diff #211110)

Can you leave a comment saying that we want two different stringize functions for ELF and COFF, so the function is named toCOFFString?

This revision is now accepted and ready to land.Jul 23 2019, 11:39 AM
thakis marked an inline comment as done.Jul 23 2019, 11:59 AM

Thanks!

This revision was automatically updated to reflect the committed changes.