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

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Rui,<br>
<br>
Currently the entrySymbol gets added to the undefined atom pool by createInternalFiles().<br>
<br>
The main problem that I have with the change thats now present is every occurence of the entry option is going to cause add an undefined symbol, which is not correct.<br></blockquote><div><br></div><div>That's right. I thought that the entry symbol was not handled but looks like I tested in a wrong way. Sorry about the confusion and thank you for pointing this out! I'll revert the change to LinkingContext.h. I'll leave the test as is, for it's a good test.</div>

<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Thanks<br>
<br>
Shankar Easwaran<div class="im"><br>
<br>
On 9/2/2013 10:13 PM, Rui Ueyama wrote:<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
On Mon, Sep 2, 2013 at 8:08 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><u></u>wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
First, I dont think setEntrySymbolName should add to the list of undefined<br>
symbols as soon as you see it.<br>
<br>
</blockquote>
So, if we do that in Driver.cpp (not in code to process command line<br>
options in each driver file), we do not add entry symbol to the dead strip<br>
list?<br>
<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
If you still want to do that, make the setEntrySymbolName overridden in<br>
PECOFFLinkingContext and add your code there.<br>
<br>
Default the behavior on how it was originally, that it just sets the<br>
internal protected variable, as ELF/MachO has the same usecase.<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<br>
<br>
On 9/2/2013 9:51 PM, Rui Ueyama wrote:<br>
<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Just rolling back this patch will again regress COFF handling, so I don't<br>
want to simply revert. Instead, I think I can add code to Driver.cpp to<br>
copy entry symbol name to deadStripRoot. In this way the two symbols won't<br>
be added in your example. What do you think?<br>
<br>
<br>
On Mon, Sep 2, 2013 at 6:50 PM, Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a><br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
**wrote:<br>
</blockquote>
  Hi Ruiu,<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
This cannot be done, there is a genuine case that if you set the entry<br>
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<br>
undefine symbol twice.<br>
<br>
Can you please revert this change as it breaks ELF ?<br>
<br>
Thanks<br>
<br>
Shankar Easwaran<br>
<br>
<br>
<br>
On 9/2/2013 8:00 PM, Rui Ueyama wrote:<br>
<br>
  Author: ruiu<br>
</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">
Date: Mon Sep  2 20:00:01 2013<br>
New Revision: 189776<br>
<br></div>
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><<a href="http://llvm.org/viewvc/llvm-**project?rev=189776&view=rev" target="_blank"><u></u>http://llvm.org/viewvc/llvm-**<u></u>project?rev=189776&view=rev</a>><br>


<ht**tp://<a href="http://llvm.org/viewvc/llvm-**project?rev=189776&view=rev" target="_blank">llvm.org/viewvc/<u></u>llvm-**project?rev=189776&<u></u>view=rev</a><<a href="http://llvm.org/viewvc/llvm-project?rev=189776&view=rev" target="_blank">http://llvm.org/<u></u>viewvc/llvm-project?rev=<u></u>189776&view=rev</a>><div class="im">

<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></div>
       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/****" target="_blank">http://llvm.org/viewvc/llvm-**<u></u>**project/lld/trunk/include/<u></u>lld/****</a><<a href="http://llvm.org/viewvc/llvm-**project/lld/trunk/include/lld/**" target="_blank">http://llvm.org/<u></u>viewvc/llvm-**project/lld/<u></u>trunk/include/lld/**</a>><br>


Core/LinkingContext.h?rev=****<u></u>189776&r1=189775&r2=189776&***<u></u>*view=diff<<br>
<a href="http://llvm.org/**viewvc/llvm-project/lld/trunk/**include/lld/Core/**" target="_blank">http://llvm.org/**viewvc/llvm-<u></u>project/lld/trunk/**include/<u></u>lld/Core/**</a><br>
LinkingContext.h?rev=189776&**<u></u>r1=189775&r2=189776&view=diff<<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"><u></u>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>
==================<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<div class="im"><br>
<br>
2013<br>
@@ -184,7 +184,9 @@ public:<br>
      // Set the entry symbol name. You may also need to call<br>
addDeadStripRoot() for<br>
      // the symbol if your platform supports dead-stripping, so that the<br>
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></div>
+    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/****" target="_blank">http://llvm.org/viewvc/llvm-**<u></u>**project/lld/trunk/test/<u></u>pecoff/****</a><<a href="http://llvm.org/viewvc/llvm-**project/lld/trunk/test/pecoff/**" target="_blank">http://llvm.org/<u></u>viewvc/llvm-**project/lld/<u></u>trunk/test/pecoff/**</a>><br>


entry.test?rev=189776&view=***<u></u>*auto<<a href="http://llvm.org/viewvc/**" target="_blank">http://llvm.org/viewvc/*<u></u>*</a><br>
llvm-project/lld/trunk/test/**<u></u>pecoff/entry.test?rev=189776&*<u></u>*view=auto<<a href="http://llvm.org/viewvc/llvm-project/lld/trunk/test/pecoff/entry.test?rev=189776&view=auto" target="_blank">http://llvm.org/<u></u>viewvc/llvm-project/lld/trunk/<u></u>test/pecoff/entry.test?rev=<u></u>189776&view=auto</a>><br>


==============================<u></u>****==========================<u></u>==**==**<br>
==================<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<div class="im"><br>
<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></div>
______________________________<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><<a href="http://lists.cs.uiuc.edu/**mailman/listinfo/llvm-commits" target="_blank"><u></u>http://lists.cs.uiuc.edu/**<u></u>mailman/listinfo/llvm-commits</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><<a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank"><u></u>http://lists.cs.uiuc.edu/<u></u>mailman/listinfo/llvm-commits</a>><br>


<br>
<br>
  --<br>
</blockquote><div class="im">
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
<br>
<br>
</div></blockquote></blockquote><div class="im">
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
<br>
</div></blockquote></blockquote><div class="HOEnZb"><div class="h5">
<br>
<br>
-- <br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by the Linux Foundation<br>
<br>
</div></div></blockquote></div><br></div></div>