<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Mar 24, 2017, at 4:22 PM, Reid Kleckner via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">I figured you might consider moving the basenames of the filename earlier in the diagnostic, something like:<div class=""><br class=""><div class=""><span class="gmail-im" style="font-family:monospace,monospace;font-size:12.8px">bin/ld.lld: <b style="color:rgb(255,0,0)" class="">error:</b> duplicate symbol: lld::elf::MipsGotSection::<wbr class="">addEntry(lld::elf::SymbolBody&<wbr class="">, long, lld::elf::RelExpr)</span><div style="font-family:monospace,monospace;font-size:12.8px" class=""><b class="">>>> defined at</b> Writer.cpp:<wbr class="">38 in <span style="font-size:12.8px" class="">/home/buildslave/buildslave/</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">clang-cmake-aarch64-39vma/</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">llvm/tools/lld/ELF/</span></div><div style="font-family:monospace,monospace;font-size:12.8px" class=""><b class="">>>></b>            <span style="font-size:12.8px" class="">Writer.cpp.o in archive </span><span style="font-size:12.8px" class="">lib/liblldELF.a</span></div><div style="font-family:monospace,monospace;font-size:12.8px" class=""><b class="">>>> defined at</b> SyntheticSections.cpp:673 in <span style="font-size:12.8px" class="">/home/buildslave/buildslave/</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">clang-cmake-aarch64-39vma/</span><wbr style="font-size:12.8px" class=""><span style="font-size:12.8px" class="">llvm/tools/lld/ELF/</span></div><div style="font-family:monospace,monospace;font-size:12.8px" class=""><b class="">>>></b>            <span style="font-size:12.8px" class="">SyntheticSections.cpp.o in archive </span><span style="font-size:12.8px" class="">lib/liblldELF.a</span></div></div></div></div></div></blockquote><div><br class=""></div><div>I find this really nicely readable!</div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><div class=""><div class=""><br class=""></div></div><div class="">Oftentimes filenames are unique enough that it tells you where to go immediately. Maybe it's a bad idea for the source location info, though. You want that to be copy-pastable or clickable in an IDE.</div></div><div class="gmail_extra"><br class=""><div class="gmail_quote">On Fri, Mar 24, 2017 at 4:07 PM, Rui Ueyama via llvm-dev <span dir="ltr" class=""><<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr" class=""><div class="gmail_extra"><div class="gmail_quote"><span class="">On Fri, Mar 24, 2017 at 2:04 PM, Sean Silva <span dir="ltr" class=""><<a href="mailto:chisophugis@gmail.com" target="_blank" class="">chisophugis@gmail.com</a>></span> wrote:<br class=""><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto" class=""><div class="">I lile the idea of having it more structured and I think your suggested format is the right direction.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">I think one principle should be that we assume that file names and symbol names are "really long" (possibly wrapped by the terminal etc.).</div></div></blockquote><div class=""><br class=""></div></span><div class="">Right. That's what we should expect.</div><div class=""><br class=""></div><div class="">I believe the current error message format for the existing linkers were set more than 30 years ago when path names and symbol names were much shorter than they are today. If they are short, error messages become something like "src/libfoo/bar.o: undefined symbol: strbar", which is quite easy to read. That is unfortunately no longer the case because we are creating significantly larger programs than a few decades ago and C++ name mangling makes symbol names significantly longer than before.</div><span class=""><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto" class=""><div dir="auto" class="">So I would modify your suggested format to use the "note" color for the strings like "Object 1" so that even if those lines are wrapped by the terminal then they can still be easily visually parsed. We may also want to do something like ">>> Object 1:" so that places without color (like google's internal web ui for build logs, or if users are piping the build system's output into `less` or `tee`) are still a bit easier to parse in the presence of wrapped lines.</div></div></blockquote><div class=""><br class=""></div></span><div class="">Makes sense. I tried a few different formats based on suggestions from Mehdi, Hans and you, and come up with this one. What do you think?</div><div class=""><br class=""></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class="gmail_extra"><div class="gmail_quote"><font face="monospace, monospace" class=""><div class="">bin/ld.lld: <font color="#ff0000" class=""><b class="">error:</b></font> undefined symbol: lld::elf::EhFrameSection<llvm:<wbr class="">:object::ELFType<(llvm::<wbr class="">support::endianness)0, true> >::addSection(lld::elf::<wbr class="">InputSectionBase*)</div><div class=""><b class="">>>> referenced by</b> /home/buildslave/buildslave/<wbr class="">clang-cmake-aarch64-39vma/<wbr class="">llvm/tools/lld/ELF/Writer.cpp:<wbr class="">207</div><div class=""><b class="">>>></b>               lib/liblldELF.a(Writer.cpp.o)</div><span class=""><div class=""><br class=""></div><div class=""><br class=""></div><div class="">bin/ld.lld: <b style="color:rgb(255,0,0)" class="">error:</b> duplicate symbol: lld::elf::MipsGotSection::<wbr class="">addEntry(lld::elf::SymbolBody&<wbr class="">, long, lld::elf::RelExpr)</div></span><div class=""><b class="">>>> defined at</b> /home/buildslave/buildslave/<wbr class="">clang-cmake-aarch64-39vma/<wbr class="">llvm/tools/lld/ELF/Writer.cpp:<wbr class="">38</div><div class=""><b class="">>>></b>            lib/liblldELF.a(Writer.cpp.o)</div><div class=""><b class="">>>> defined at</b> /home/buildslave/buildslave/<wbr class="">clang-cmake-aarch64-39vma/<wbr class="">llvm/tools/lld/ELF/<wbr class="">SyntheticSections.cpp:673</div><div class=""><b class="">>>></b>            lib/liblldELF.a(<wbr class="">SyntheticSections.cpp.o)</div></font></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div class=""><br class=""></div><div class="">This format prints out source file names and object file names in different lines. I found that that is easier to read than print them in the same line, as error messages with some amount of whitespace are easier to find in dense build system outputs.</div><div class=""><div class="h5"><div class=""><br class=""></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="auto" class=""><div dir="auto" class="">This principle also suggests (and your suggested format does this) that to avoid having to parse past a symbol/file name to get to other information, there should be at most one symbol/file name on a given line and there should never be anything after it on the line. The ld64 format violates this, for example.</div><div dir="auto" class=""><br class=""></div><div dir="auto" class="">-- Sean Silva<br class=""><div class="gmail_extra" dir="auto"><br class=""><div class="gmail_quote"><div class=""><div class="m_-7137631181086882753gmail-m_-2039451436578983823gmail-h5">On Mar 23, 2017 4:18 PM, "Rui Ueyama via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution" class=""></div></div><blockquote class="m_-7137631181086882753gmail-m_-2039451436578983823gmail-m_-3086134180091544953m_-5073081004223806894quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div class=""><div class="m_-7137631181086882753gmail-m_-2039451436578983823gmail-h5"><div dir="ltr" class=""><div class="">Folks,</div><div class=""><br class=""></div><div class="">I'd like propose a new error message format for LLD so that error message for undefined or duplicated symbols are more informative and easy to read.</div><div class=""><br class=""></div><div class="">Below are examples of the current error messages (note that characters in red are actually red on terminal):</div><div class=""><div class=""><br class=""></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><div class=""><b class="">Undefined symbols</b></div></div><div class=""><div class="">/ssd/clang/bin/ld.lld: <font color="#ff0000" class="">error</font>: /ssd/llvm-project/lld/ELF/Writ<wbr class="">er.cpp:207: undefined symbol 'lld::elf::EhFrameSection<llvm<wbr class="">::object::ELFType<(llvm::suppo<wbr class="">rt::endianness)0, true> >::addSection(lld::elf::InputS<wbr class="">ectionBase*)'</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class=""><b class="">Conflicting symbols</b></div></div><div class=""><div class="">/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)" class="">error</span>: /ssd/llvm-project/lld/ELF/Writ<wbr class="">er.cpp:38: duplicate symbol 'lld::elf::MipsGotSection::add<wbr class="">Entry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)'</div></div><div class=""><div class="">/ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Synt<wbr class="">heticSections.cpp:673: previous definition was here</div></div></blockquote><div class=""><br class=""></div><div class=""><div class="">For each error, we want to print out information about 1) symbol name, 2) source file name(s) and source location(s) if available and 3) source object file name(s) and archive file name(s) if available. Currently, these messages lack object file names, and I think the above error messages are a bit hard to grasp because too much information is packed into each line.</div><div class=""><br class=""></div></div><div class="">I'm thinking of changing the format to something like the following:</div><div class=""><br class=""></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px" class=""><div class=""><div class=""><b class="">Undefined symbols</b></div></div><div class=""><div class="">/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)" class="">error</span>: undefined symbol: lld::elf::EhFrameSection<llvm:<wbr class="">:object::ELFType<(llvm::suppor<wbr class="">t::endianness)0, true> >::addSection(lld::elf::InputS<wbr class="">ectionBase*)</div></div><div class=""><div class="">  Source: /ssd/llvm-project/lld/ELF/Writ<wbr class="">er.cpp:207</div></div><div class=""><div class="">  Object: lib/liblldELF.a(Writer.cpp.o)</div></div><div class=""><div class=""><br class=""></div></div><div class=""><div class=""><b class="">Conflicting symbols</b></div></div><div class=""><div class="">/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)" class="">error</span>: duplicate symbol: lld::elf::MipsGotSection::addE<wbr class="">ntry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)</div></div><div class=""><div class="">  Source 1: /ssd/llvm-project/lld/ELF/Writ<wbr class="">er.cpp:38</div></div><div class=""><div class="">  Source 2: /ssd/llvm-project/lld/ELF/Synt<wbr class="">heticSections.cpp:673</div></div><div class=""><div class="">  Object 1: lib/liblldELF.a(Writer.cpp.o)</div></div><div class=""><div class="">  Object 2 : lib/liblldELF.a(SyntheticSecti<wbr class="">ons.cpp.o)</div></div></blockquote><div class=""><br class=""></div><div class="">The new error messages contain complete information that the linker is able to gather, and it uses more vertical space to improve readability.</div><div class=""><br class=""></div><div class="">Thoughts?</div></div>
<br class=""></div></div>______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div></div></div>
</blockquote></div></div></div><br class=""></div></div>
<br class="">______________________________<wbr class="">_________________<br class="">
LLVM Developers mailing list<br class="">
<a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank" class="">http://lists.llvm.org/cgi-bin/<wbr class="">mailman/listinfo/llvm-dev</a><br class="">
<br class=""></blockquote></div><br class=""></div>
_______________________________________________<br class="">LLVM Developers mailing list<br class=""><a href="mailto:llvm-dev@lists.llvm.org" class="">llvm-dev@lists.llvm.org</a><br class="">http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev<br class=""></div></blockquote></div><br class=""></body></html>