<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Mar 24, 2017 at 2:04 PM, Sean Silva <span dir="ltr"><<a href="mailto:chisophugis@gmail.com" target="_blank">chisophugis@gmail.com</a>></span> wrote:<br><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"><div>I lile the idea of having it more structured and I think your suggested format is the right direction.</div><div dir="auto"><br></div><div dir="auto">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><br></div><div>Right. That's what we should expect.</div><div><br></div><div>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><div><br></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"><div dir="auto">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><br></div><div>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><br></div></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div class="gmail_extra"><div class="gmail_quote"><font face="monospace, monospace"><div>bin/ld.lld: <font color="#ff0000"><b>error:</b></font> undefined symbol: lld::elf::EhFrameSection<llvm::object::ELFType<(llvm::support::endianness)0, true> >::addSection(lld::elf::InputSectionBase*)</div><div><b>>>> referenced by</b> /home/buildslave/buildslave/clang-cmake-aarch64-39vma/llvm/tools/lld/ELF/Writer.cpp:207</div><div><b>>>></b>               lib/liblldELF.a(Writer.cpp.o)</div><div><br></div><div><br></div><div>bin/ld.lld: <b style="color:rgb(255,0,0)">error:</b> duplicate symbol: lld::elf::MipsGotSection::addEntry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)</div><div><b>>>> defined at</b> /home/buildslave/buildslave/clang-cmake-aarch64-39vma/llvm/tools/lld/ELF/Writer.cpp:38</div><div><b>>>></b>            lib/liblldELF.a(Writer.cpp.o)</div><div><b>>>> defined at</b> /home/buildslave/buildslave/clang-cmake-aarch64-39vma/llvm/tools/lld/ELF/SyntheticSections.cpp:673</div><div><b>>>></b>            lib/liblldELF.a(SyntheticSections.cpp.o)</div></font></div></div></blockquote><div class="gmail_extra"><div class="gmail_quote"><div><br></div><div>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><br></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"><div dir="auto">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"><br></div><div dir="auto">-- Sean Silva<br><div class="gmail_extra" dir="auto"><br><div class="gmail_quote"><div><div class="gmail-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">llvm-dev@lists.llvm.org</a>> wrote:<br type="attribution"></div></div><blockquote class="gmail-m_-2039451436578983823gmail-m_-3086134180091544953m_-5073081004223806894quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div class="gmail-m_-2039451436578983823gmail-h5"><div dir="ltr"><div>Folks,</div><div><br></div><div>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><br></div><div>Below are examples of the current error messages (note that characters in red are actually red on terminal):</div><div><div><br></div></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><b>Undefined symbols</b></div></div><div><div>/ssd/clang/bin/ld.lld: <font color="#ff0000">error</font>: /ssd/llvm-project/lld/ELF/Writ<wbr>er.cpp:207: undefined symbol 'lld::elf::EhFrameSection<llvm<wbr>::object::ELFType<(llvm::suppo<wbr>rt::endianness)0, true> >::addSection(lld::elf::InputS<wbr>ectionBase*)'</div></div><div><div><br></div></div><div><div><b>Conflicting symbols</b></div></div><div><div>/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)">error</span>: /ssd/llvm-project/lld/ELF/Writ<wbr>er.cpp:38: duplicate symbol 'lld::elf::MipsGotSection::add<wbr>Entry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)'</div></div><div><div>/ssd/clang/bin/ld.lld: error: /ssd/llvm-project/lld/ELF/Synt<wbr>heticSections.cpp:673: previous definition was here</div></div></blockquote><div><br></div><div><div>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><br></div></div><div>I'm thinking of changing the format to something like the following:</div><div><br></div><blockquote style="margin:0px 0px 0px 40px;border:none;padding:0px"><div><div><b>Undefined symbols</b></div></div><div><div>/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)">error</span>: undefined symbol: lld::elf::EhFrameSection<llvm:<wbr>:object::ELFType<(llvm::suppor<wbr>t::endianness)0, true> >::addSection(lld::elf::InputS<wbr>ectionBase*)</div></div><div><div>  Source: /ssd/llvm-project/lld/ELF/Writ<wbr>er.cpp:207</div></div><div><div>  Object: lib/liblldELF.a(Writer.cpp.o)</div></div><div><div><br></div></div><div><div><b>Conflicting symbols</b></div></div><div><div>/ssd/clang/bin/ld.lld: <span style="color:rgb(255,0,0)">error</span>: duplicate symbol: lld::elf::MipsGotSection::addE<wbr>ntry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)</div></div><div><div>  Source 1: /ssd/llvm-project/lld/ELF/Writ<wbr>er.cpp:38</div></div><div><div>  Source 2: /ssd/llvm-project/lld/ELF/Synt<wbr>heticSections.cpp:673</div></div><div><div>  Object 1: lib/liblldELF.a(Writer.cpp.o)</div></div><div><div>  Object 2 : lib/liblldELF.a(SyntheticSecti<wbr>ons.cpp.o)</div></div></blockquote><div><br></div><div>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><br></div><div>Thoughts?</div></div>
<br></div></div>______________________________<wbr>_________________<br>
LLVM Developers mailing list<br>
<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
<br></blockquote></div><br></div></div></div>
</blockquote></div><br></div></div>