<div dir="ltr">Just rolling back this patch will again regress COFF handling, so I don't want to simply revert. Instead, I think I can add code to Driver.cpp to copy entry symbol name to deadStripRoot. In this way the two symbols won't be added in your example. What do you think?</div>

<div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Sep 2, 2013 at 6:50 PM, Shankar Easwaran <span dir="ltr"><<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Ruiu,<br>
<br>
This cannot be done, there is a genuine case that if you set the entry symbol twice like this<br>
<br>
lld -flavor gnu -target x86_64 -e _start -e main<br>
<br>
I want to take only the last entry symbol, now this will trigger an undefine symbol twice.<br>
<br>
Can you please revert this change as it breaks ELF ?<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<div class="HOEnZb"><div class="h5"><br>
<br>
<br>
On 9/2/2013 8:00 PM, Rui Ueyama wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Author: ruiu<br>
Date: Mon Sep  2 20:00:01 2013<br>
New Revision: 189776<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=189776&view=rev" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project?rev=189776&view=rev</a><br>
Log:<br>
Partially revert r189718 to add entry symbol to dead strip root.<br>
<br>
Also added a test to verify that entry symbol is not stripped even if<br>
dead stripping is enabled.<br>
<br>
Added:<br>
     lld/trunk/test/pecoff/entry.<u></u>test<br>
Modified:<br>
     lld/trunk/include/lld/Core/<u></u>LinkingContext.h<br>
<br>
Modified: lld/trunk/include/lld/Core/<u></u>LinkingContext.h<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/include/lld/Core/LinkingContext.h?rev=189776&r1=189775&r2=189776&view=diff" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/include/lld/<u></u>Core/LinkingContext.h?rev=<u></u>189776&r1=189775&r2=189776&<u></u>view=diff</a><br>


==============================<u></u>==============================<u></u>==================<br>
--- lld/trunk/include/lld/Core/<u></u>LinkingContext.h (original)<br>
+++ lld/trunk/include/lld/Core/<u></u>LinkingContext.h Mon Sep  2 20:00:01 2013<br>
@@ -184,7 +184,9 @@ public:<br>
    // Set the entry symbol name. You may also need to call addDeadStripRoot() for<br>
    // the symbol if your platform supports dead-stripping, so that the symbol<br>
    // will not be removed from the output.<br>
-  virtual void setEntrySymbolName(StringRef name) {<br>
+  void setEntrySymbolName(StringRef name) {<br>
+    // Entry function have to be resolved as an undefined symbol.<br>
+    addInitialUndefinedSymbol(<u></u>name);<br>
      _entrySymbolName = name;<br>
    }<br>
  <br>
Added: lld/trunk/test/pecoff/entry.<u></u>test<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/entry.test?rev=189776&view=auto" target="_blank">http://llvm.org/viewvc/llvm-<u></u>project/lld/trunk/test/pecoff/<u></u>entry.test?rev=189776&view=<u></u>auto</a><br>


==============================<u></u>==============================<u></u>==================<br>
--- lld/trunk/test/pecoff/entry.<u></u>test (added)<br>
+++ lld/trunk/test/pecoff/entry.<u></u>test Mon Sep  2 20:00:01 2013<br>
@@ -0,0 +1,9 @@<br>
+# REQUIRES: debug<br>
+# Verify that entry atom will not be dead-stripped.<br>
+<br>
+# RUN: yaml2obj %p/Inputs/main.obj.yaml > %t.obj<br>
+# RUN: lld -flavor link /mllvm -debug-only=WriterPECOFF /out:%t.exe \<br>
+# RUN:   /subsystem:console /entry:_main /force -- %t.obj >& %t.log<br>
+# RUN: FileCheck %s < %t.log<br>
+<br>
+CHECK: : _main<br>
<br>
<br>
______________________________<u></u>_________________<br>
llvm-commits mailing list<br>
<a href="mailto:llvm-commits@cs.uiuc.edu" target="_blank">llvm-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a><br>
<br>
<br>
</blockquote>
<br>
<br></div></div><span class="HOEnZb"><font color="#888888">
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</font></span></blockquote></div><br></div>