<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Wed, Nov 8, 2017 at 9:33 AM, Rafael Avila de Espindola <span dir="ltr"><<a href="mailto:rafael.espindola@gmail.com" target="_blank">rafael.espindola@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span>Rui Ueyama <<a href="mailto:ruiu@google.com" target="_blank">ruiu@google.com</a>> writes:<br>
<br>
>> If you are creating an executable and if your executable is not<br>
>> > position-independent, you're using Initial Exec model by default which is<br>
>> > as fast as variables accessed through GOT. If you really want to use<br>
>> Local<br>
>> > Exec model, you can pass -ftls-model=local-exec to compilers.<br>
>><br>
>> But then all the used variables have to be defined in the same<br>
>> executable. You can't have even one from a shared library (think errno).<br>
>><br>
><br>
> Not really -- you can still use Local Exec per variable basis using the<br>
> visibility attribute. I don't think that we can observe noticeable<br>
> difference in performance between Initial Exec and Local Exec except an<br>
> synthetic benchmark though.<br>
<br>
</span>There nothing that the linker can do that the compiler could not have<br>
done in the first place. The point is that if to switch to lld and keep<br>
performance users should not have to annotate all tls variables with<br>
tls-model.<br>
<span><br>
> The nice thing about linker relaxations is that they are very user<br>
>> friendly. The linker is the first point in the toolchaing where some<br>
>> usefull fact is know, and it can optimize the result with no user<br>
>> intervention.<br>
><br>
><br>
> I think I agree with this point. Automatic linker code relaxation is<br>
> convenient and if it makes a difference, we should implement that. But I'd<br>
> doubt if TLS relaxation is actually effective. George implemented them<br>
> because there's a spec defining how to relax them, and I accepted the<br>
> patches without thinking hard enough, but I didn't see a convincing<br>
> benchmark result (or even a non-convincing one) that shows that these<br>
> relaxations actually make real-world programs faster. Do you know of<br>
> any? It is funny that even the creator of TLSDESC found that their<br>
> optimization didn't actually makes NPTL faster as it is mentioned in the<br>
> "Conclusion" section in <a href="http://www.fsfla.org/~lxoliva/" rel="noreferrer" target="_blank">http://www.fsfla.org/~lxoliva/</a><br>
> writeups/TLS/RFC-TLSDESC-x86.t<wbr>xt.<br>
><br>
> So I don't think I'm proposing we simplify code by degrading user's code.<br>
> It feels more like we are making too much effort on something that doesn't<br>
> produce any measurable difference in real life.<br>
<br>
</span>*PLEASE* let us keep it. It is bad enough that we are regressing<br>
performance in the name of having code that you find nicer. It would be<br>
really annoying to see us drop a working feature just to reduce our<br>
code a bit.<br></blockquote><div><br></div><div>Please take it easy. :) I'm not saying that I'm going to remove it. Instead, I'm bringing a (possibly crazy) idea to the table to discuss, and that is IMO a good thing. Part of the reason why lld is successful is because of its relatively radical design choice such as Windows-ish library semantics, which might have been somewhat crazy idea. So, I think "stop, think and re-evaluate what has traditionally been done" is what we are good at, regardless of the conclusion of the assessment. And as you know we (including you) have been making reasonable decisions on technical design choices.</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">The code is working, please let it be!<br>
<br>
At the very least we should keep it until we are in a position to<br>
actually measure it. As is this is just guesswork. We would need a<br>
*much* bigger adoption before we could measure this.<br>
<br>
Cheers,<br>
Rafael<br>
</blockquote></div><br></div></div>