Date: Sat, 19 Jul 2003 09:24:06 -0700 From: Marcel Moolenaar <marcel@xcllnt.net> To: Alexander Kabaev <kabaev@mail.ru> Cc: threads@freebsd.org Subject: Re: Some more on TLS Message-ID: <20030719162406.GA16766@dhcp01.pn.xcllnt.net> In-Reply-To: <20030719095406.02c51beb.kabaev@mail.ru> References: <20030719045625.GB45759@dhcp01.pn.xcllnt.net> <20030719095406.02c51beb.kabaev@mail.ru>
next in thread | previous in thread | raw e-mail | index | archive | help
On Sat, Jul 19, 2003 at 09:54:06AM -0400, Alexander Kabaev wrote: > > > o There's no assembler support for TLS on i386 and amd64. > > amd64 is new and TLS is probably not activated enabled in binutils yet. > > i386 assebmly thing: what do you mean? > > % cat test.c > .section ".tdata","awT",@progbits > foo: .long 25 > .text > movl %gs:0, %eax > leal foo@TLSGD(,%ebx,1), %eax > leal foo@TLSLDM(%ebx), %eax > leal foo@DTPOFF(%eax), %edx > movl foo@GOTTPOFF(%ebx), %eax > subl foo@GOTTPOFF(%ebx), %eax > addl foo@GOTNTPOFF(%ebx), %eax > movl foo@INDNTPOFF, %eax > movl $foo@TPOFF, %eax > subl $foo@TPOFF, %eax > leal foo@NTPOFF(%ecx), %eax Our in-tree compiler emits assembly that our assembler doesn't like. Given the following C program: \begin{c} int __thread i = 3; int x() { return i; } \end{c} Our compiler emits: \begin{as} .file "t.c" .globl %li .section .tdata,"awT",@progbits .p2align 2 .type %li, @object .size %li, 4 %li: .long 3 .text .p2align 2,,3 .globl x .type x, @function x: pushl %ebp movl %esp, %ebp movl %gs:0, %eax movl %li@NTPOFF(%eax), %eax leave ret .size x, .-x .ident "GCC: (GNU) 3.3.1 [FreeBSD] 20030711 (prerelease)" \end{as} And the assembler does not like that: /var/tmp//ccVMU4H6.s: Assembler messages: /var/tmp//ccVMU4H6.s:2: Warning: rest of line ignored; first ignored character is `%' /var/tmp//ccVMU4H6.s:5: Error: unrecognized symbol type "li" /var/tmp//ccVMU4H6.s:5: Warning: rest of line ignored; first ignored character is `,' /var/tmp//ccVMU4H6.s:6: Error: expected comma after name `' in .size directive /var/tmp//ccVMU4H6.s:6: Warning: rest of line ignored; first ignored character is `%' /var/tmp//ccVMU4H6.s:7: Warning: rest of line ignored; first ignored character is `%' /var/tmp//ccVMU4H6.s:17: Error: bad register name `%li@NTPOFF(%eax)' It's probably just the %l and %G prefix, but it makes the use of the __thread keyword rather pointless at this time. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030719162406.GA16766>