From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94883 invoked by alias); 17 May 2019 14:08:43 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 94874 invoked by uid 89); 17 May 2019 14:08:43 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-5.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.1 spammy=H*i:sk:87o941p, H*f:sk:87o941p X-HELO: simark.ca Received: from simark.ca (HELO simark.ca) (158.69.221.121) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 17 May 2019 14:08:38 +0000 Received: from [172.16.0.120] (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id 567831E636; Fri, 17 May 2019 10:08:36 -0400 (EDT) Subject: Re: Getting offset of inital-exec TLS variables on GNU/Linux To: Florian Weimer , gdb@sourceware.org References: <87o941pej8.fsf@oldenburg2.str.redhat.com> From: Simon Marchi Message-ID: <19f008ac-ffb7-5e15-ae6c-5fc00791c964@simark.ca> Date: Fri, 17 May 2019 14:34:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: <87o941pej8.fsf@oldenburg2.str.redhat.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-05/txt/msg00032.txt.bz2 On 2019-05-17 6:21 a.m., Florian Weimer wrote: > Is it possible to obtain the offset of initial-exec TLS variable on > GNU/Linux? > > It doesn't seem so because GDB executes the DWARF to access the TLS > variable, so the offset is an implementation detail. Although it is > often visible at the ELF layer. > > Thanks, > Florian Can you clarify a little bit? You are looking for the offset the variable from which point of reference: - The start of the TLS area of this module? - The start of the TLS area of the current thread? - Something else? Also, are you looking for something you can find statically, with just the executable, or are you working in the context of the live process? Simon