]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
Pull in r195318 from upstream llvm trunk:
authordim <dim@FreeBSD.org>
Thu, 21 Nov 2013 23:09:07 +0000 (23:09 +0000)
committerdim <dim@FreeBSD.org>
Thu, 21 Nov 2013 23:09:07 +0000 (23:09 +0000)
commit15069c877cd7d53a245e0b37701d29dbaea64996
treecce6e563cf584684a353855162fb2c5ac41a68e2
parent305492af4723b9c7a9118c02471b58651d2ec999
Pull in r195318 from upstream llvm trunk:

  The basic problem is that some mainstream programs cannot deal with the way
  clang optimizes tail calls, as in this example:

  int foo(void);
  int bar(void) {
  return foo();
  }

  where the call is transformed to:

   calll .L0$pb
  .L0$pb:
   popl  %eax
  .Ltmp0:
   addl  $_GLOBAL_OFFSET_TABLE_+(.Ltmp0-.L0$pb), %eax
   movl  foo@GOT(%eax), %eax
   popl  %ebp
   jmpl  *%eax                   # TAILCALL

  However, the GOT references must all be resolved at dlopen() time, and so this
  approach cannot be used with lazy dynamic linking (e.g. using RTLD_LAZY), which
  usually populates the PLT with stubs that perform the actual resolving.

  This patch changes X86TargetLowering::LowerCall() to skip tail call
  optimization, if the called function is a global or external symbol.

This fixes problems with loading X.org driver modules, which could occur
when X.org was compiled on i386 with tailcall optimization on, for which
ports r312583 was committed as a workaround.  After this change, the
workaround can be removed.

MFC after: 3 days
contrib/llvm/lib/Target/X86/X86ISelLowering.cpp