From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 42190 invoked by alias); 10 Oct 2016 15:13:15 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 42181 invoked by uid 89); 10 Oct 2016 15:13:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=Headers, wat, flg, Flg X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 10 Oct 2016 15:13:13 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 416434E049; Mon, 10 Oct 2016 15:13:12 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-55.ams2.redhat.com [10.36.116.55]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u9AFD95g005619 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 10 Oct 2016 11:13:11 -0400 Date: Mon, 10 Oct 2016 15:13:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch+7.12.1 2/2] Fix TLS (such as 'errno') regression Message-ID: <20161010151308.GA21241@host1.jankratochvil.net> References: <20161009185647.GB13645@host1.jankratochvil.net> <87shs4xnpd.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <87shs4xnpd.fsf@tromey.com> User-Agent: Mutt/1.7.0 (2016-08-17) X-IsSubscribed: yes X-SW-Source: 2016-10/txt/msg00220.txt.bz2 On Mon, 10 Oct 2016 16:50:38 +0200, Tom Tromey wrote: > My only question about this patch is why the symbol's section has a > non-zero section offset. Is that the reason why? > > Maybe it would make sense to make a SEC_THREAD_LOCAL section always have > a zero offset. Then touching all the users wouldn't be necessary. IIUC you mean this subexpression could be zero (which it is not): ANOFFSET ((objfile)->section_offsets, ((symbol)->mginfo.section) Section Headers: [Nr] Name Type Address Off Size ES Flg Lk Inf Al [19] .tdata PROGBITS 0000000000200db4 000db4 000004 00 WAT 0 0 4 Symbol table '.symtab' contains 71 entries: Num: Value Size Type Bind Vis Ndx Name 54: 0000000000000000 4 TLS GLOBAL DEFAULT 19 thread_local All the sections have the same offset for PIE - the PIE load base address. And I do not think it is correct to set that offset to zero for SHF_TLS as the thread initialization data is really located at the section address relocated by that PIE-load-base address. > On the third hand it seems strange to even try to get the "address" of a > TLS symbol in this way. There could be a symbol's getter which asserts/throws on reading address of a TLS symbol? Maybe, not a part of this patch. Jan