From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 46256 invoked by alias); 14 Sep 2017 10:25:34 -0000 Mailing-List: contact elfutils-devel-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Post: List-Help: List-Subscribe: Sender: elfutils-devel-owner@sourceware.org Received: (qmail 45961 invoked by uid 89); 14 Sep 2017 10:25:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Checked: by ClamAV 0.99.2 on sourceware.org X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy= X-Spam-Status: No, score=-2.9 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on sourceware.org X-Spam-Level: X-Spam-User: qpsmtpd, 2 recipients X-HELO: mail-pf0-f170.google.com Received: from mail-pf0-f170.google.com (HELO mail-pf0-f170.google.com) (209.85.192.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 14 Sep 2017 10:25:31 +0000 Received: by mail-pf0-f170.google.com with SMTP id e1so4271379pfk.1; Thu, 14 Sep 2017 03:25:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=eVgbYkVh8ENRJRHE+JHfNXNAHK/AwL0RECqoJTxQ1ug=; b=bj9P3x91lg0mKa3+AVRPG9LbxdM1cuQJGHhIN0fKehvOGmY5KtFkM+gpuRL3gKqmzV RYjq69xFRDRBX3LuFFGYFwTJgIQIfioEP+7CJ6LyUhlXGX07rpJtP4bNURLy9pPSsOxd dK0E/O9dhRbiHwMzw3ZNwfsj+WAB5LsPhprReZFkvL/roDRldMaDUMoLZ5S7yPvfoL+Y ChD5tH7oheitAS1C3ipWWWF8/hzitIaHvDqOAnzCvBrpshEcSD9gTiR/9zjH0PnJ2QI1 1ctrh07lLoc1dNvjNOyqWexcGS8uIhl8lO3T1GA2aZdSgGTRa1pwGcPdTYt+ij/R53Rr h1HQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=eVgbYkVh8ENRJRHE+JHfNXNAHK/AwL0RECqoJTxQ1ug=; b=FVQJRfQJ36In0MQpGnr+sz4/L0bi6LfUYIG/k1jiq7h21Pqlj5yVAFmegSe0l6oOc8 K3r6qKokCUUuSlAmO8DD5HUZCZQubLyddol6mUPp5En9miZB01bR5DeIuVVZ0R9keu4F qXmf+eI85D0cZYERtmtZPUgCWxwby1S4KWVVyK+M5HrEESjRfJnyYIOJWpXTSJSfv+CB uND4zhZCSLJ1cDik+v/p/29+NbES/7mQLMVp8ETtwtMDWjyM31nHEaMJUkC5/SQgEQJ0 zFpSGUjviRaKyRpyVDUsCfqVkDfuiMYVR4HQ2J9zhSlm3Qb+8mRkulocjs7CiDQcnvYN Ib3w== X-Gm-Message-State: AHPjjUge24M6kCZgWuwJWHDD3Q1A9nLguzwqqCaMl4PwdzS3J3ivNyPd uNWhKG9bWli+jA== X-Google-Smtp-Source: ADKCNb5A+ScAU8nHmsWpVTUqgl4KYesKrNoaOJetLpKp/2XsWJuoAS1cFDLvamp6UX0zwciRoz9smA== X-Received: by 10.84.228.207 with SMTP id y15mr22909099pli.301.1505384730121; Thu, 14 Sep 2017 03:25:30 -0700 (PDT) Received: from bubble.grove.modra.org (CPE-58-175-73-248.czqe1.win.bigpond.net.au. [58.175.73.248]) by smtp.gmail.com with ESMTPSA id j13sm32038396pfk.107.2017.09.14.03.25.28 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 14 Sep 2017 03:25:29 -0700 (PDT) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 6A62EC2876; Thu, 14 Sep 2017 19:55:25 +0930 (ACST) Date: Thu, 14 Sep 2017 10:25:00 -0000 From: Alan Modra To: Yubin Ruan Cc: binutils@sourceware.org, elfutils-devel@sourceware.org Subject: Re: entries in PT_DYNAMIC section refer to the correct address at runtime? Message-ID: <20170914102525.GJ3528@bubble.grove.modra.org> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-SW-Source: 2017-q3/txt/msg00106.txt.bz2 On Thu, Sep 14, 2017 at 12:09:51PM +0800, Yubin Ruan wrote: > Hi, > > I read the ELF spec and note that, a segment designated by a program > header of type PT_DYNAMIC have several entries, many of which contain > addresses of other things. For example, an entry of type DT_SYMTAB was > described (in the ELF) spec to "holds the address of the symbol > table". I wonder whether this address is true at runtime? > > Normally a program header would have the following structure: > > typedef struct { > Elf32_Word p_type; > Elf32_Off p_offset; > Elf32_Addr p_vaddr; > Elf32_Addr p_paddr; > Elf32_Word p_filesz; > Elf32_Word p_memsz; > Elf32_Word p_flags; > Elf32_Word p_align; > } Elf32_Phdr; > > The `p_vaddr` hold the virtual address (runtime address) for a shared > object file and a executable file. But, as stated in the ELF spec, > `p_vaddr` might not be correct for a shared object (because it is > required to be PIC). So, if that `p_vaddr` is not correct, will those > entries in PT_DYNAMIC be correct? DT_ entries that specify addresses will need to be offset by the base address. -- Alan Modra Australia Development Lab, IBM