<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Nov 22, 2013 at 2:14 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">If its doing that, it might be following the Darwin model. The Darwin model picks up all the object files and puts all the libraries that it wants to link inside a Group(Snipped from a discussion earlier with Nick).<br>

</blockquote><div><br></div><div>Which thread?</div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
May be COFF should follow similiar things here.<br>
<br>
Thanks<span class="HOEnZb"><font color="#888888"><br>
<br>
Shankar Easwaran</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
On 11/22/2013 4:09 PM, Rui Ueyama wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I'm not sure if it's usual that you specify the library files *after* the<br>
object files, because in the command line to link LLD on Windows, "lld.obj"<br>
is given as the last argument in the command line. It may be exceptional,<br>
but the link would succeed anyway, so it happened to demonstrate that the<br>
link order is not the same as in Unix.<br>
<br>
On Fri, Nov 22, 2013 at 9:16 AM, Mikael Lyngvig <<a href="mailto:mikael@lyngvig.org" target="_blank">mikael@lyngvig.org</a>> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
The way I recall DOS/Windows linking, you could specify object files after<br>
the library files and the link would still succeed.  As a matter of fact,<br>
you usually speciy the library files after the objects files on Windows.<br>
  You might want to experiment with the Microsoft Linker to see how it does<br>
things.  It has been almost twenty years since I did linkers, but I recall<br>
that things were done in such a way that you never had to juggle load order<br>
to satisfy the linker's resolution algorithm.  Sorry if I am a bit hazy on<br>
this, but it has been too long since I developed linkers for me to remember<br>
the precise details.<br>
<br>
-- Mikael<br>
<br>
<br>
<br>
<br>
2013/11/22 Shankar Easwaran <<a href="mailto:shankare@codeaurora.org" target="_blank">shankare@codeaurora.org</a>><br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
On 11/20/2013 7:33 PM, Mikael Lyngvig wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
As a former DOS/NT linker engineer (SSI, XLINK386, an absolute embedded<br>
linker - probably the world's most advanced linker ever), I'd like to add<br>
that Windows linkers don't search in the Unix-style one way only.  On<br>
Windows, you can do things like foo.obj kernel32.lib oldnames.lib without<br>
running into problems.  On Windows, the linkers typically make a gigantic<br>
symbol table of all the symbols defined in the input files and then<br>
resolve<br>
that way.<br>
<br>
</blockquote>
Are you saying that windows linkers, just go over the input .obj files<br>
and then look at .lib files ?<br>
<br>
    The only time the link order matters is if there are duplicate<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
symbols, in which case the first input file that provides the symbol is<br>
picked so that the user can predict what happens if he or she overrides a<br>
library symbol.<br>
<br>
</blockquote>
GNU has --allow-multiple-definitions, with which the first defined symbol<br>
wins, if they are defined in multiple object files.<br>
<br>
  I think you should consider to use that method in lld as the Unix method<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
is<br>
less than optimal: It is not a rare sight that a Unix link fails only<br>
because of wrong library order.  Then you have to sit and juggle the<br>
linker's input files for a while, until the beast caves in and does what<br>
you expect it to do: Link with the least amount of trouble on your parth.<br>
<br>
  Unix link also does the layout as how symbols were resolved from the<br>
</blockquote>
input files in command line order.<br>
<br>
This can be controlled in lld, where the LinkingContext chooses whats the<br>
next file to bring to the resolver to resolve symbols.<br>
<br>
Thanks<br>
<br>
Shankar easwaran<br>
<br>
--<br>
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted<br>
by the Linux Foundation<br>
<br>
<br>
</blockquote></blockquote></blockquote>
<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>