[LLVMdev] problem with __thread on linux/x86_64

Jay Foad jay.foad at gmail.com
Thu Nov 11 05:59:38 PST 2010


On 11 November 2010 13:22, Jay Foad <jay.foad at gmail.com> wrote:
> On 11 November 2010 12:49, Jay Foad <jay.foad at gmail.com> wrote:
>> Delving a bit deeper, the difference seems to be that symbol "i" in
>> the assembler source:
>>
>>        .type   i, at object               # @i
>>        .section        .tdata,"awT", at progbits
>>        .globl  i
>>        .align  4
>> i:
>>        .long   7                       # 0x7
>>        .size   i, 4
>>
>> ... is given ELF symbol type STT_TLS by gcc's assembler, but
>> STT_OBJECT by clang's assembler.
>
> The .type directive should probably specify type "tls_object" rather
> than just "object".

The attached patch fixes this, and it makes my favourite (proprietary)
app work on Linux when compiled with clang.

> But I think gas infers that this is a TLS symbol
> anyway, because it is mentioned in TLS-related relocations.

I still think clang's assembler needs to do something like this, if it
wants to be able to assembler .s files generated by GCC.

Jay.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: typetls.diff
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20101111/5e7e579d/attachment.bin>


More information about the llvm-dev mailing list