<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 23, 2017, at 3:17 PM, Rui Ueyama 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=""><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:0 0 0 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:0 0 0 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></blockquote></div></div></blockquote><div><br class=""></div><div>As a point of comparison, here is what ld64 displays:</div><div><br class=""></div><div>Undefined symbols for architecture x86_64:<br class="">  "lld::elf::EhFrameSection<llvm:<wbr class="">:object::ELFType<(llvm::suppor<wbr class="">t::endianness)0, true> >::addSection(lld::elf::InputS<wbr class="">ectionBase*)", referenced from:<br class="">      foo() in lib/liblldELF.a(Writer.cpp.o)<br class=""><br class=""></div><div>Being able to display source location when available is a really nice idea!!</div><div><br class=""></div><br class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class=""><blockquote style="margin:0 0 0 40px;border:none;padding:0px" class=""><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></div></blockquote><div><br class=""></div><div>I feel it is using too much vertical space, and the matching between source and object is lost. What about something like:</div><div><br class=""></div><div>/ssd/clang/bin/ld.lld: error: duplicate symbol: lld::elf::MipsGotSection::addEntry(lld::elf::SymbolBody&, long, lld::elf::RelExpr)<br class="">  - Defined in lib/liblldELF.a(Writer.cpp.o) (from /ssd/llvm-project/lld/ELF/Writer.cpp:38)</div><div>  - Defined in lib/liblldELF.a(SyntheticSections.cpp.o) (from /ssd/llvm-project/lld/ELF/SyntheticSections.cpp:673)</div><div><br class=""></div><div><br class=""></div><div>— </div><div>Mehdi</div><div><br class=""></div></div></body></html>