<div dir="ltr">I read through the binutils mailing list thread, but I couldn't find the exact reason why making --hash-style=gnu default except MIPS wasn't a good idea.Do you mind if I ask you to explain it again for me?<div><br></div><div>Since lld is a new linker, we could make a bit more radical change than GNU ld can do, so I wonder if --hash-style=both is the right choice for us.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Oct 2, 2017 at 3:00 PM, Romain GEISSLER <span dir="ltr"><<a href="mailto:romain.geissler@amadeus.com" target="_blank">romain.geissler@amadeus.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div style="word-wrap:break-word"><span class="">
<div>
<blockquote type="cite">
<div>Le 2 oct. 2017 à 18:37, Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> a écrit :</div>
<br class="m_-3846277692935936244Apple-interchange-newline">
<div>
<div dir="ltr">Changing default to "both" is probably fine, but what does that change actually mean in practice? I believe clang already passes --hash-style=both to the linker by default.</div>
</div>
</blockquote>
</div>
<br>
</span><div>Not exactly.</div>
<div><br>
</div>
<div>The current Linux driver (I haven't checked other ELF-based systems) reads this (<a href="https://github.com/llvm-mirror/clang/blob/master/lib/Driver/ToolChains/Linux.cpp#L228" target="_blank">https://github.com/llvm-<wbr>mirror/clang/blob/master/lib/<wbr>Driver/ToolChains/Linux.cpp#<wbr>L228</a>)</div>
<div><br>
</div>
<div><br>
// Do not use 'gnu' hash style for Mips targets because .gnu.hash<br>
// and the MIPS ABI require .dynsym to be sorted in different ways.<br>
// .gnu.hash needs symbols to be grouped by hash code whereas the MIPS<br>
// ABI requires a mapping between the GOT and the symbol table.<br>
// Android loader does not support .gnu.hash.<br>
// Hexagon linker/loader does not support .gnu.hash<br>
if (!IsMips && !IsAndroid && !IsHexagon) {<br>
if (Distro.IsRedhat() || Distro.IsOpenSUSE() ||<br>
(Distro.IsUbuntu() && Distro >= Distro::UbuntuMaverick))<br>
ExtraOpts.push_back("--hash-<wbr>style=gnu");<br>
<br>
if (Distro.IsDebian() || Distro.IsOpenSUSE() || Distro == Distro::UbuntuLucid ||<br>
Distro == Distro::UbuntuJaunty || Distro == Distro::UbuntuKarmic)<br>
ExtraOpts.push_back("--hash-<wbr>style=both");<br>
}</div>
<div><br>
</div>
<div>Given that several libc implementation supports this in the Linux ecosystem (glibc, musl, uClibc, most likely others) I think lld should provide good defaults by default, instead of relying on what some distro maintainer have hardcoded for their
own distro in clang.</div>
<div><br>
</div>
<div>Cheers,</div>
<div>ROmain</div>
</div>
</blockquote></div><br></div>