<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Mon, Mar 6, 2017 at 12:18 AM, Sean Silva via Phabricator <span dir="ltr"><<a href="mailto:reviews@reviews.llvm.org" target="_blank">reviews@reviews.llvm.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">silvas added a comment.<br>
<span class=""><br>
In <a href="https://reviews.llvm.org/D30544#692075" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D30544#692075</a>, @ruiu wrote:<br>
<br>
> I'd think we should continue handling it as an error. There are a few reasons:<br>
><br>
> 1. The GNU linkers don't allow that (thank you George for investigating!). That means almost all Unix projects don't add non-object files to .a files, so in practice the current behavior is desirable for most people.<br>
<br>
<br>
</span>It sounds like this would be for compatibility with the PlayStation proprietary Unix linker, not with the GNU linkers. Last I heard, PlayStation has officially committed to LLD, so we should take their concerns seriously (as with any platform that wants to use LLD as their system linker).<br>
<br>
That being said, it's not clear just how critical this is. Owen, can you quantify or otherwise clarify the impact of this feature on your customers? For example, would an excellent error diagnostic be acceptable instead of a warning?<br>
<span class=""><br>
> 2. Assume that foo.a contains x.o, y.o and z.o. The current semantics of `--whole-archive foo.a --no-whole-archive` is the same as `x.o y.o z.o`, which is a pretty simple rule. This patch changes that semantics. I think that's not a good thing to do.<br>
<br>
</span>I think this would be a really good reason to keep the current behavior. However, it does not appear to be the case:<br>
<br>
  sean:~/pg/llvm/release % ./bin/llvm-ar rcs foo.a build.ninja<br>
  sean:~/pg/llvm/release % ./bin/ld.lld --whole-archive foo.a --no-whole-archive<br>
  ./bin/ld.lld: error: build.ninja: invalid data encoding<br>
  zsh: exit 1     ./bin/ld.lld --whole-archive foo.a --no-whole-archive<br>
  sean:~/pg/llvm/release % ./bin/ld.lld build.ninja<br>
  ./bin/ld.lld: error: build.ninja:21: malformed number: 1.5<br>
  ./bin/ld.lld: error: build.ninja:21: ninja_required_version = 1.5<br>
  ./bin/ld.lld: error: build.ninja:21:                          ^<br>
  ./bin/ld.lld: error: target emulation unknown: -m or at least one .o file required<br>
  zsh: exit 1     ./bin/ld.lld build.ninja<br></blockquote><div><br></div><div>Ah, that's true. You can put only object files (either it is in the native format or in the LLVM bitcode) to archive files. Archive files cannot contain other archives, shared libraries or linker scripts. I stand corrected.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<span class=""><br>
<br>
<br>
> 3. It is easy to relax this error check, but tightening it later is hard. I don't want to relax this unless a strong reason to do is presented.<br>
<br>
</span>This is a good reason. I think the providing an excellent diagnostic might be a good middleground.<br>
<br>
<br>
<a href="https://reviews.llvm.org/D30544" rel="noreferrer" target="_blank">https://reviews.llvm.org/<wbr>D30544</a><br>
<br>
<br>
<br>
</blockquote></div><br></div></div>