Incorrect local-dynamic TLS linker optimization with clang-generated code on PowerPC

Chandler Carruth chandlerc at gmail.com
Wed Jan 28 11:17:28 PST 2015


First off, many thanks for digging through this! =D

On Wed, Jan 28, 2015 at 8:02 AM, Ulrich Weigand <Ulrich.Weigand at de.ibm.com>
wrote:

> Chandler, as a workaround it should be possible to use the initial-exec TLS
> model for this variable; this should work fine (at least on Linux).   Using
> the following line:
>
> static __thread __attribute__((tls_model("initial-exec"))) const
>   PrettyStackTraceEntry *PrettyStackTraceHead = nullptr;
>
> I was able to complete a bootstrap on powerpc64le-linux (Ubuntu 14.04).
>

This works for folks linking LLVM statically into the executable, but my
understanding is that it doesn't work in other cases (some folks dlopen
LLVM). I'm going to try forcing it to always be general dynamic and
precluding local dynamic on PPC64 so we actually get the function call. If
that makes the bots happy, I'll use that. Otherwise, the options become
either using initial-exec and breaking dlopens or hacking back in pthread
TLS under a macro. Hoping to avoid the latter as I'd like to use raw TLS in
a few other places in LLVM.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150128/f287cfcf/attachment.html>


More information about the llvm-commits mailing list