<div dir="ltr">On Sun, Jul 21, 2013 at 8:25 PM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div dir="ltr"><div>I remember Nick suggested two pass solution. In the first pass, we read all the object files given via the command line only to gather linker directives to construct a TargetInfo. In the second pass, the TargetInfo is passed to the core linker and is treated as a const object. This might work for ELF, but wouldn't for COFF, because of the issue when linking the archive file. We should not parse directives of all files in a library file, but parse only the file needed for linking. That information is not available until we actually try to link objects, so we can't split it into two passes.</div>
</div></blockquote><div><br></div><div>Hm, that's really frustrating, and is probably worth elaborating on.  It seems like the following could happen:</div><div><br></div><div>foo.lib contains objs:</div><div>  use_bar.obj contains .drectve /defaultlib:bar.lib</div>
<div>  use_baz.obj contains .drectve /defaultlib:baz.lib<br></div><div><br></div><div>A user of foo.lib might only ever call into one of use_bar.obj or use_baz.obj depending on some define like NDEBUG or _MSC_VER.  bar.lib and baz.lib might have conflicting symbols, so they can't both be linked in as would happen in a two-pass solution.</div>
</div></div></div>