On Oct 14, 2013, at 22:42, "Mikhail T." <mi+t...@aldan.algebra.com> wrote:
> 10/14/13 4:31 PM, Dimitry Andric написав(ла):
>> There is a problem when clang does tail-call optimization on i386 with
>> PIC in effect, and it emits GOT relocations for the tail-called
>> functions, instead of PLT relocations.  In some scenarios, such as with
>> the way X.org does lazy dynamic linking, this can cause problems.  See
>> also 
>> http://llvm.org/PR15086
>>  (which I unfortunately did not get much
>> response on).
>> 
> Ouch... That seems like a show-stopper for clang-adoption... At least, on 
> i386.

Well, the scenario is very difficult to reproduce, at least when I tried
it.  You must have a very specific way of dynamically loading objects,
and you must load them in the "wrong" order, or the problem will not
occur.  Normally linked .so's do not have this problem at all.  So
hardly a showstopper, 10.0 is being released with clang as we speak. :-)


>> For now, a workaround is to recompile the affected .so files with
>> -fno-optimize-sibling-calls (if you are optimizing).
>> 
> Maybe, our clang (both src/ and ports/) should be compiled with that being in 
> effect by default on i386?

For the specific cases where it occurs (as far as I knew until know,
only certain X.org drivers) it might be enough to just use
-fno-optimize-sibling-calls.  If this problem occurs more often, I will
see if I can make it the default for i386-with-PIC.

-Dimitry

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

Reply via email to