<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 9, 2015 at 2:18 PM, Rafael Ávila de Espíndola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">rafael added inline comments.<br>
<br>
================<br>
Comment at: ELF/Writer.cpp:245<br>
@@ -242,1 +244,3 @@<br>
+    if (auto *S = dyn_cast<SharedSymbol<ELFT>>(Body))<br>
+      S->File->IsUsed = true;<br>
   }<br>
----------------<br>
I don't think this correctly handles weak symbols.<br>
<br>
It should not set the bit if the symbol is only used to satisfy a weak undefined.  For that it looks like you need to fetch the original SymbolBody, not the replacement.<br></blockquote><div><br></div><div>Hrm, that's not something easily be done. Maybe I need to do something in the symbol table. Let me try.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
================<br>
Comment at: test/elf2/as-needed.s:8<br>
@@ +7,3 @@<br>
+<br>
+// RUN: ld.lld2 %t.o %t2.so %t3.so -o %t2<br>
+// RUN: llvm-readobj -dynamic-table %t2 | FileCheck %s<br>
----------------<br>
Please also add a test for the weak undefined case.<br>
<br>
<br>
<a href="http://reviews.llvm.org/D13579" rel="noreferrer" target="_blank">http://reviews.llvm.org/D13579</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>