This is the mail archive of the
elfutils-devel@sourceware.org
mailing list for the elfutils project.
entries in PT_DYNAMIC section refer to the correct address at runtime?
- From: Yubin Ruan <ablacktshirt at gmail dot com>
- To: binutils at sourceware dot org
- Cc: elfutils-devel at sourceware dot org
- Date: Thu, 14 Sep 2017 12:09:51 +0800
- Subject: entries in PT_DYNAMIC section refer to the correct address at runtime?
- Authentication-results: sourceware.org; auth=none
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to:cc; bh=xKPV9Whr3yYDpUouu/eWhjqBjzqRkHtOomDQTRwuy9s=; b=mLPKJGAuAMhfutRGRN3jfUflTacawbQyRv9hLoMVMr8+K5dFlexZ0OgJd8de+5hmaX Zt5voD2y9zB4FZTD4Ls6FnAC4Cxa8BccTE2V6vFuVioLrAzHUcMG1jAUdOsRZzDUDpNo cQubORcSyi73p1pxESzquBjTbGFHgooZuadwU5imBdCLj3JKHUaxGnSwqkE34kyvaIdN 1G0UmUt2QyFxeNx88NsX/okNLz23RtizItntAYvT6mE9Dxa3mXNY5O3M/wQ6JUBkqSDZ azyIQKx6ZkyZzZFB+5NCm4Q1f+uuRBNM08aOyL4BU5jnIrpU/7go+wpRwBgjslQP2qUH wO9Q==
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?
Yubin