[LLVMbugs] [Bug 13502] New: clang++ compiles TLS code even when there is no TLS support on the OS

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Aug 1 00:40:15 PDT 2012


             Bug #: 13502
           Summary: clang++ compiles TLS code even when there is no TLS
                    support on the OS
           Product: clang
           Version: 3.1
          Platform: Other
        OS/Version: OpenBSD
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: C++
        AssignedTo: unassignedclangbugs at nondot.org
        ReportedBy: landry at openbsd.org
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

While working on building mozilla with clang on OpenBSD, i realized that the
following code :

__thread bool tlsIsMainThread = false;
int main() {
return tlsIsMainThread;

(from http://mxr.mozilla.org/mozilla-central/source/configure.in#3611)

compiles with clang but fails to run, while it fails to compile on gcc, and for
a good reason : OpenBSD doesn't have thread-local-storage support (yet).

This is confusing the mozilla-central's configure.in into thinking TLS is

dawn:/tmp/ $g++ t.C
t.C:1: error: thread-local storage not supported for this target
dawn:/tmp/ $clang++ t.C                                                         
dawn:/tmp/ $./a.out                                                             
./a.out: unsupported TLS program header

Note sure it's a real bug...

Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.

More information about the llvm-bugs mailing list