<div dir="ltr">I'm OK to revert this patch entirely if it is still annoying, but in the first place why Chromium has an archive file that has no symbols?</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 30, 2016 at 12:11 PM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra">Also, in case it isn't that way yet, please make sure that for warnings:</div><div class="gmail_extra"><br></div><div class="gmail_extra">1.) It's possible to turn warnings into errors</div><div class="gmail_extra">2.) It's possible to disable every warning with some flag</div><div class="gmail_extra"><br></div><div class="gmail_extra">(like in clang)</div><div class="gmail_extra"><br>For warnings to be enforceable, we need warnings-as-errors. But we might not want to fix all the things that a tool warns about, so we need to be able to disable warnings we think are useful.</div><div><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 30, 2016 at 1:03 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I'd instead make it precise; if an archive file has no symbol table and it contains a LLVM bitcode file, it is likely that the file was created by mistake. What do you think?</div><div class="m_-5726753707395278573HOEnZb"><div class="m_-5726753707395278573h5"><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Sep 30, 2016 at 9:58 AM, Nico Weber <span dir="ltr"><<a href="mailto:thakis@chromium.org" target="_blank">thakis@chromium.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p dir="ltr">libtool (on mac) warns on this, and it's spectacularly unhelpful. We filter out that warning in a wrapper script since there's no flag to turn it off and the warning is just noise in our build. If lld gets this warning, please provide a way to toggle it off.</p><div class="m_-5726753707395278573m_8455915324500932941HOEnZb"><div class="m_-5726753707395278573m_8455915324500932941h5">
<div class="gmail_extra"><br><div class="gmail_quote">On Sep 30, 2016 12:31 PM, "Reid Kleckner" <<a href="mailto:rnk@google.com" target="_blank">rnk@google.com</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Are you sure we should be warning on empty archives? This comes up in Chromium's build, which apparently has an archive with no symbols:<div><a href="https://build.chromium.org/p/chromium.fyi/builders/ClangToTLinuxLLD/builds/1596/steps/compile/logs/stdio" target="_blank">https://build.chromium.org/p/c<wbr>hromium.fyi/builders/ClangToTL<wbr>inuxLLD/builds/1596/steps/comp<wbr>ile/logs/stdio</a></div><div><br>That build also doesn't involve LTO, so the long explanatory comment isn't helpful.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 28, 2016 at 2:10 PM, Rui Ueyama via llvm-commits <span dir="ltr"><<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Author: ruiu<br>
Date: Wed Sep 28 16:10:54 2016<br>
New Revision: 282633<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=282633&view=rev" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject?rev=282633&view=rev</a><br>
Log:<br>
Warn on empty archive files.<br>
<br>
Differential Revision: <a href="https://reviews.llvm.org/D25044" rel="noreferrer" target="_blank">https://reviews.llvm.org/D2504<wbr>4</a><br>
<br>
Modified:<br>
lld/trunk/ELF/InputFiles.cpp<br>
lld/trunk/test/ELF/empty-archi<wbr>ve.s<br>
<br>
Modified: lld/trunk/ELF/InputFiles.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputFiles.cpp?rev=282633&r1=282632&r2=282633&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/ELF/InputFiles<wbr>.cpp?rev=282633&r1=282632&r2=2<wbr>82633&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/ELF/InputFiles.cpp (original)<br>
+++ lld/trunk/ELF/InputFiles.cpp Wed Sep 28 16:10:54 2016<br>
@@ -427,8 +427,17 @@ template <class ELFT> void ArchiveFile::<br>
File = check(Archive::create(MB), "failed to parse archive");<br>
<br>
// Read the symbol table to construct Lazy objects.<br>
- for (const Archive::Symbol &Sym : File->symbols())<br>
+ bool IsEmpty = true;<br>
+ for (const Archive::Symbol &Sym : File->symbols()) {<br>
Symtab<ELFT>::X->addLazyArchi<wbr>ve(this, Sym);<br>
+ IsEmpty = false;<br>
+ }<br>
+<br>
+ if (IsEmpty)<br>
+ warning(getName() + " has no symbol. Chances are you are doing "<br>
+ "an LTO build and forgot to use an ar command that can create "<br>
+ "a symbol table for LLVM bitcode files. If so, use llvm-ar or "<br>
+ "GNU ar + plugin.");<br>
}<br>
<br>
// Returns a buffer pointing to a member file containing a given symbol.<br>
<br>
Modified: lld/trunk/test/ELF/empty-archi<wbr>ve.s<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/ELF/empty-archive.s?rev=282633&r1=282632&r2=282633&view=diff" rel="noreferrer" target="_blank">http://llvm.org/viewvc/llvm-pr<wbr>oject/lld/trunk/test/ELF/empty<wbr>-archive.s?rev=282633&r1=28263<wbr>2&r2=282633&view=diff</a><br>
==============================<wbr>==============================<wbr>==================<br>
--- lld/trunk/test/ELF/empty-archi<wbr>ve.s (original)<br>
+++ lld/trunk/test/ELF/empty-archi<wbr>ve.s Wed Sep 28 16:10:54 2016<br>
@@ -1,3 +1,5 @@<br>
// RUN: llvm-ar rc %t.a<br>
// RUN: llvm-mc -filetype=obj -triple=x86_64-pc-linux %s -o %t.o<br>
-// RUN: ld.lld -shared %t.o %t.a -o t<br>
+// RUN: ld.lld -shared %t.o %t.a -o t 2>&1 | FileCheck %s<br>
+<br>
+// CHECK: has no symbol.<br>
<br>
<br>
______________________________<wbr>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@lists.llvm.org" target="_blank">llvm-commits@lists.llvm.org</a><br>
<a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-commits</a><br>
</blockquote></div><br></div>
</blockquote></div></div>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>