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

            Bug ID: 17058
           Summary: Shared library relocation R_X86_64_TPOFF32 with
                    __thread
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Driver
          Assignee: [email protected]
          Reporter: [email protected]
                CC: [email protected]
    Classification: Unclassified

I don't know if the code is completely correct, but I get the following error
when trying to compile a shared library:

ld: /tmp/tsd-cGUFwW.o: relocation R_X86_64_TPOFF32 against `function.data' can
not be used when making a shared object; recompile with -fPIC

Of course, recompiling with -fPIC gives the same error.

The offending code is:
===========================

int function(void)
{
  static __thread int data __attribute__ ((tls_model ("initial-exec")));
  return data;
}

===========================

I compile it as a shared library:

clang -nostdlib -shared -fPIC file.c

Adding or removing the -fPIC option does nothing. Compiling as a normal
executable works. The code also works when I remove the final return of the
data, possibly because the variable is optimized away.

-- 
You are receiving this mail because:
You are on the CC list for the bug.
_______________________________________________
LLVMbugs mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/llvmbugs

Reply via email to