<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Thu, Nov 16, 2017 at 10:06 AM, Rui Ueyama <span dir="ltr"><<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>></span> wrote:<br><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"><div class="gmail_quote"><span class="">On Wed, Nov 15, 2017 at 10:45 PM, N <span dir="ltr"><<a href="mailto:scandium@me.com" target="_blank">scandium@me.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>> You can't really remove any native linker-compatible command line interface unless you get agreement from all parties including Microsoft and Apple to switch to the GNU command line as the universal interface in the future versions of their toolchains.<br>
<br>
</span>I completely agree; that's why I said this is not feasible for the time being.<br>
<br>
I am still wondering about a few things:<br>
<br>
Is it desired to address the functional difference of the flavours at all?<br>
<br>
Is it a bug if a flavour has a feature that its original counterpart does not have? For example, would it be<br>
acceptable to add scripting support to the Darwin flavour, given that Apple ld64 does not support scripts?</blockquote><div><br></div></span><div>No and no. It is not desired and it is not a bug.</div></div></div></div></blockquote><div><br></div><div>Sorry, the last "no" is to your last sentence. We generally want to implement all features to make lld drop-in replacements to the existing linkers, but any additional features beyond that should be carefully examined and discussed per-feature basis before being accepted.</div><div><br></div><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"><div class="gmail_quote"><div><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="m_2126266482082755983HOEnZb"><div class="m_2126266482082755983h5">
> On 14 Nov 2017, at 03:07, Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> wrote:<br>
><br>
> On Mon, Nov 13, 2017 at 9:31 PM, N <<a href="mailto:scandium@me.com" target="_blank">scandium@me.com</a>> wrote:<br>
> > For example, MSVC link.exe doesn't have --start-group and --end-group options because their symbol resolution semantics are different than Unix.<br>
><br>
> Yes, but this is specific for a linker, not for a target. For example, GNU ld supports this option for all binary formats. A linker with universal CLI would then<br>
> support this flag for all targets as well (or drop the support for all targets if recursive dependency resolution can be implemented without that flag).<br>
><br>
> > link.exe on the other hand doesn't have --init or --fini options because that's ELF-only concept.<br>
><br>
> Yes, so a universal CLI would hide this flag when linking non-ELF binaries, as well as any other option not supported by the target currently linking for.<br>
> (This is not the same as using a separate flavour for that target.)<br>
><br>
> > Linker scripts exist only in GNU.<br>
><br>
><br>
> My reasoning is the same as for `start-group'. In fact, lld does not achieve feature parity with GNU ld configured for mach-o here:<br>
> the latter can use scripts when linking a mach-o binary, but lld cannot use scripts at all unless GNU flavor is used, and then mach-o is<br>
> unsupported.<br>
><br>
> > Also, I think if we try to create a unified interface, I guess it would end up with this situation -- <a href="https://xkcd.com/927/" rel="noreferrer" target="_blank">https://xkcd.com/927/</a>. We have three standards -- GNU, Darwin and MSVC. I don't know if we want another one.<br>
><br>
> This depends on whether the flavoured CLIs are removed upon merge. (Of course, it is probably impractical to remove them all at once.)<br>
><br>
> You can't really remove any native linker-compatible command line interface unless you get agreement from all parties including Microsoft and Apple to switch to the GNU command line as the universal interface in the future versions of their toolchains. Our linker is designed to be a drop-in replacement, so in that sense, we are just a follower. If you are really aiming for a universal command line interface, I think you need to convince not us but other first-party toolchain developers.<br>
><br>
> In my opinion, GNU ld has CLI closest to my description, so it is a good basis for a universal interface. In fact, GNU flavour can be universal if support<br>
> for more targets is added there, but then the other flavours will likely be redundant. One difference would be that a universal CLI need not maintain compatibility<br>
> with GNU ld CLI.<br>
><br>
> > On 1 Nov 2017, at 20:36, Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> wrote:<br>
> ><br>
> > Most command line options in GNU, macOS and MSVC are not just different in terms of notion but different in terms of semantics. For example, MSVC link.exe doesn't have --start-group and --end-group options because their symbol resolution semantics are different than Unix. link.exe on the other hand doesn't have --init or --fini options because that's ELF-only concept. Linker scripts exist only in GNU. You cannot hide these differences even if you create a unified driver, which makes a unified driver less attractive to me.<br>
> ><br>
> > Also, I think if we try to create a unified interface, I guess it would end up with this situation -- <a href="https://xkcd.com/927/" rel="noreferrer" target="_blank">https://xkcd.com/927/</a>. We have three standards -- GNU, Darwin and MSVC. I don't know if we want another one.<br>
> ><br>
> > On Wed, Nov 1, 2017 at 12:16 PM, N via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > I am aware of these flags, but this is not my point. I am talking about Darwin and Link lld drivers<br>
> > not being on par with the GNU driver. While using clang for linking helps, as it provides some flags<br>
> > to the linker, as soon as you want to do something clang does not automatically do, you still have<br>
> > the issue of different flags for different drivers/targets.<br>
> ><br>
> > > On 1 Nov 2017, at 20:08, Jonathan Roelofs <<a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a>> wrote:<br>
> > ><br>
> > ><br>
> > ><br>
> > > On 11/1/17 10:29 AM, N via llvm-dev wrote:<br>
> > >> Thank you for your answers.<br>
> > >> Indeed, Clang is universal, but only until one needs to pass some commands to the linker which are not<br>
> > >> automatically passed by the driver. Then we are back to the same problem.<br>
> > ><br>
> > > Clang and GCC both support the `-Wl,` and `-Xlinker` flags...<br>
> > ><br>
> > ><br>
> > > Jon<br>
> > ><br>
> > >> In my opinion, it would be great if lld had a unified, GNU-like interface. Of course, if nobody else is interested,<br>
> > >> it's probably not even worth it drafting an RFC. :(<br>
> > >>> On 27 Oct 2017, at 01:09, James Y Knight <<a href="mailto:jyknight@google.com" target="_blank">jyknight@google.com</a>> wrote:<br>
> > >>><br>
> > >>> I mean, there is such a universal driver -- it's called "clang".<br>
> > >>><br>
> > >>><br>
> > >>> On Oct 26, 2017 5:31 PM, "Rui Ueyama via llvm-dev" <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > >>> Martell recently added "ld64.lld" as a name for the Darwin driver.<br>
> > >>><br>
> > >>> As to why there's no driver that provides a unified command line arguments, I can't speak for other people. But no one seems to have been interested in it enough to actually invent and implement a set of unified command line arguments.<br>
> > >>><br>
> > >>> On Thu, Oct 26, 2017 at 2:20 PM, N <<a href="mailto:scandium@me.com" target="_blank">scandium@me.com</a>> wrote:<br>
> > >>>> I think using ld.lld or lld-link is preferred way over "lld -flavor gnu" or "lld -flavor link".<br>
> > >>><br>
> > >>> -flavor seems to be still actively used in Clang… By the the way, there seems to be no special<br>
> > >>> command name for Darwin targets, so ld.lld (incorrectly) invokes the ELF linker there<br>
> > >>> (see <a href="https://bugs.llvm.org/show_bug.cgi?id=34792#c1" rel="noreferrer" target="_blank">https://bugs.llvm.org/show_bug<wbr>.cgi?id=34792#c1</a>)<br>
> > >>><br>
> > >>> Regardless, I would be interested in hearing the answer to the rest of the questions.<br>
> > >>><br>
> > >>>> On 26 Oct 2017, at 23:10, Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> wrote:<br>
> > >>>><br>
> > >>>> The -flavor option exists mostly for historical reasons. I think using ld.lld or lld-link is preferred way over "lld -flavor gnu" or "lld -flavor link".<br>
> > >>>><br>
> > >>>> On Thu, Oct 26, 2017 at 2:06 PM, N via llvm-dev <<a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a>> wrote:<br>
> > >>>> Hi all,<br>
> > >>>><br>
> > >>>> According to lld/docs/Driver.rst, Flavor command line option determines the style of lld command-line interface when invoked.<br>
> > >>>><br>
> > >>>> However, it looks like this option also determines the set of supported targets we are linking for. For example, lld -flavor gnu<br>
> > >>>> cannot link mach-o binaries, and could not link PE binaries either (well, not until rL312926).<br>
> > >>>><br>
> > >>>> Is this really intended by the design of lld? It looks the flavours are merely legacy compatibility shims, but then why is there no<br>
> > >>>> universal lld driver that is able to link binary for any platform using a unified CLI?<br>
> > >>>> ______________________________<wbr>_________________<br>
> > >>>> LLVM Developers mailing list<br>
> > >>>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > >>>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
> > >>>><br>
> > >>><br>
> > >>><br>
> > >>><br>
> > >>> ______________________________<wbr>_________________<br>
> > >>> LLVM Developers mailing list<br>
> > >>> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > >>> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
> > >>><br>
> > >>><br>
> > >> ______________________________<wbr>_________________<br>
> > >> LLVM Developers mailing list<br>
> > >> <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > >> <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
> > ><br>
> > > --<br>
> > > Jon Roelofs<br>
> > > <a href="mailto:jonathan@codesourcery.com" target="_blank">jonathan@codesourcery.com</a><br>
> > > CodeSourcery / Mentor Embedded / Siemens<br>
> ><br>
> > ______________________________<wbr>_________________<br>
> > LLVM Developers mailing list<br>
> > <a href="mailto:llvm-dev@lists.llvm.org" target="_blank">llvm-dev@lists.llvm.org</a><br>
> > <a href="http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev" rel="noreferrer" target="_blank">http://lists.llvm.org/cgi-bin/<wbr>mailman/listinfo/llvm-dev</a><br>
> ><br>
<br>
</div></div></blockquote></div></div></div><br></div></div>
</blockquote></div><br></div></div>