<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 31/07/2013 2:13, Reid Kleckner
wrote:<br>
</div>
<blockquote
cite="mid:CACs=tyK8DEA6MgBudNPfkfVZKJSk08FYHdkQGZMNrk-HA=FG_g@mail.gmail.com"
type="cite">
<div dir="ltr">On Tue, Jul 30, 2013 at 4:12 PM, Chandler Carruth <span
dir="ltr"><<a moz-do-not-send="true"
href="mailto:chandlerc@google.com" target="_blank">chandlerc@google.com</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">
<div dir="ltr">
<div class="gmail_extra"><br>
<div class="gmail_quote">
<div class="im">On Tue, Jul 30, 2013 at 3:46 PM,
Jesús Serrano García <span dir="ltr"><<a
moz-do-not-send="true"
href="mailto:dagonoweda@gmail.com"
target="_blank">dagonoweda@gmail.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
<div>
<blockquote type="cite">
<div>Looks like the <span>entry</span>
function name should be _mainCRTStartup if
subsystem is "console",</div>
<div>_WinMainCRTStartup if subsystem is
"windows", and "__DllMainCRTStartup" for
DLL.</div>
<div>See <a moz-do-not-send="true"
href="http://msdn.microsoft.com/en-us/library/f9t8842e%28v=vs.80%29.aspx"
target="_blank">http://msdn.microsoft.com/en-us/library/f9t8842e(v=vs.80).aspx</a>.</div>
</blockquote>
</div>
I think this is rather a Visual Studio
convention for its C runtime library, and the
PECOFF spec says nothing about it, so I though
that "_main" is a good default <span>entry</span>
<span>point</span> name, taking into account
that there is currently no CRT guidelines (or at
least I'm unaware of them) in the lld project.</blockquote>
<div><br>
</div>
</div>
<div>Sorry for the ambiguity, but the goal of all
the PECOFF work in LLD is to support linking in a
compatible way for Windows. If you have another
usecase for linking PECOFF, you should raise that
on the discussion list (not the commit list) as
it'll need a separate design from what we're
currently working on.</div>
<div><br>
</div>
<div>For now, as Rui has said, we should follow the
MSDN spec he cited.</div>
</div>
</div>
</div>
</blockquote>
</div>
<br>
</div>
<div class="gmail_extra">Maybe the driver should call
setEntrySymbolName() with a default if the user didn't specify
anything. Then the link.exe driver could use the Microsoft
name and the GNU ld driver can use main / _main.</div>
</div>
</blockquote>
I've attached a new patch with this changes. Now the windows driver
sets the entry symbol name according to the corresponding options.
However, this won't work in all cases. Depending on<span
id="result_box" class="" lang="en"><span class="hps"> whether</span></span>
the crt is compiled as multibyte or unicode, the entry point symbol
name changes from "mainCRTStartup" to "wmainCRTStartup", and the
same for the windows subsystem. The problem with this is that the
use of unicode is unknown at link time (or at least I don't know how
to retrieve this option from object files). One <span
id="result_box" class="short_text" lang="en"><span class="hps">possible
solution</span> <span class="hps">would be to have</span> two
entry point <span class="hps">names in the linking context</span></span>,
and find a symbol mathing any of them, but I don't like it so much.
Any ideas on this?<br>
<br>
Also, I'd like to add some tests for this feature, but I'm still
learning how the test system works.<br>
<br>
</body>
</html>