[LLVMbugs] [Bug 16901] New: attribute alias does not honor __thread specifier

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Thu Aug 15 10:38:13 PDT 2013


http://llvm.org/bugs/show_bug.cgi?id=16901

            Bug ID: 16901
           Summary: attribute alias does not honor __thread specifier
           Product: clang
           Version: 3.3
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: C++
          Assignee: unassignedclangbugs at nondot.org
          Reporter: haael at interia.pl
                CC: dgregor at apple.com, llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Hello guys and ladies.

Clang 3.3 does not honor __thread specifier on an alias declaration.

How to reproduce it. First create 2 files (fileA.c and fileB.c):


====== fileA.c =========
__thread int x;
========================


====== fileB.c =========
extern __thread int y __attribute__((alias("x")));
int main(int argc, char **argv)
{
    return y;
}
========================

Compile it:
clang fileA.c fileB.c


The error will be something like:
ld: x: TLS definition in /tmp/test1-HNs8cE.o section .tbss mismatches non-TLS
reference in /tmp/test2-A6WKVL.o
/tmp/test2-A6WKVL.o: could not read symbols: Bad value
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Some experiments:

If you remove BOTH __thread specifiers from the x definition in fileA.c and the
alias declaration in fileB.c, then everything will work, as clang does not
produce TLS variables.

If you remove the __thread specifier from the fileB.c, then THE RESULT WILL BE
THE SAME, thus I deduce that clang just ignores the specifier from the alias
declaration.

If you just resort to normal 'extern __thread int x' declaration in fileB.c,
then everything will work.

I suspect clang just ignores the __thread specifier in alias declarations.

I'm using clang 3.3 x86_64 compiled by gcc 4.7.1 under Slackware 14.0.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20130815/63bc6734/attachment.html>


More information about the llvm-bugs mailing list