From owner-freebsd-threads@FreeBSD.ORG Sat Jul 19 09:24:08 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B909937B404 for ; Sat, 19 Jul 2003 09:24:08 -0700 (PDT) Received: from ns1.xcllnt.net (209-128-86-226.bayarea.net [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7032B43FA3 for ; Sat, 19 Jul 2003 09:24:07 -0700 (PDT) (envelope-from marcel@xcllnt.net) Received: from dhcp01.pn.xcllnt.net (dhcp01.pn.xcllnt.net [192.168.4.201]) by ns1.xcllnt.net (8.12.9/8.12.9) with ESMTP id h6JGO7v1078414; Sat, 19 Jul 2003 09:24:07 -0700 (PDT) (envelope-from marcel@piii.pn.xcllnt.net) Received: from dhcp01.pn.xcllnt.net (localhost [127.0.0.1]) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9) with ESMTP id h6JGO6L1016809; Sat, 19 Jul 2003 09:24:06 -0700 (PDT) (envelope-from marcel@dhcp01.pn.xcllnt.net) Received: (from marcel@localhost) by dhcp01.pn.xcllnt.net (8.12.9/8.12.9/Submit) id h6JGO6vV016808; Sat, 19 Jul 2003 09:24:06 -0700 (PDT) (envelope-from marcel) Date: Sat, 19 Jul 2003 09:24:06 -0700 From: Marcel Moolenaar To: Alexander Kabaev Message-ID: <20030719162406.GA16766@dhcp01.pn.xcllnt.net> References: <20030719045625.GB45759@dhcp01.pn.xcllnt.net> <20030719095406.02c51beb.kabaev@mail.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030719095406.02c51beb.kabaev@mail.ru> User-Agent: Mutt/1.5.4i cc: threads@freebsd.org Subject: Re: Some more on TLS X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 19 Jul 2003 16:24:09 -0000 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