From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 74010 invoked by alias); 17 May 2019 14:34:52 -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 73976 invoked by uid 89); 17 May 2019 14:34:52 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=H*f:sk:19f008a, H*i:sk:19f008a 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; Fri, 17 May 2019 14:34:51 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 141EC309B153; Fri, 17 May 2019 14:34:50 +0000 (UTC) Received: from oldenburg2.str.redhat.com (ovpn-117-42.ams2.redhat.com [10.36.117.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id A4E5F1BC41; Fri, 17 May 2019 14:34:41 +0000 (UTC) From: Florian Weimer To: Simon Marchi Cc: gdb@sourceware.org Subject: Re: Getting offset of inital-exec TLS variables on GNU/Linux References: <87o941pej8.fsf@oldenburg2.str.redhat.com> <19f008ac-ffb7-5e15-ae6c-5fc00791c964@simark.ca> Date: Sun, 19 May 2019 13:00:00 -0000 In-Reply-To: <19f008ac-ffb7-5e15-ae6c-5fc00791c964@simark.ca> (Simon Marchi's message of "Fri, 17 May 2019 10:08:35 -0400") Message-ID: <87a7flp2tm.fsf@oldenburg2.str.redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes X-SW-Source: 2019-05/txt/msg00033.txt.bz2 * Simon Marchi: > 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? The offset from something related to the thread pointer to the variable, for cases where this is constant (specifically, initial-exec TLS variables). > 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? I have a live process, and it would be best if the information matched that process (even if it uses different libraries than those currently installed in the file system). Thanks, Florian