public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Yubin Ruan <ablacktshirt@gmail.com>
To: binutils@sourceware.org
Cc: elfutils-devel@sourceware.org
Subject: entries in PT_DYNAMIC section refer to the correct address at runtime?
Date: Thu, 14 Sep 2017 04:09:00 -0000	[thread overview]
Message-ID: <CAJYFCiMKh3CwuoPHKBpcqUruJxEm_M4Cr17DD9ou5aMZq1hOZw@mail.gmail.com> (raw)

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

             reply	other threads:[~2017-09-14  4:09 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-14  4:09 Yubin Ruan [this message]
2017-09-14 10:25 ` Alan Modra
2017-09-15  6:57   ` Yubin Ruan
2017-09-15  7:26     ` Alan Modra

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAJYFCiMKh3CwuoPHKBpcqUruJxEm_M4Cr17DD9ou5aMZq1hOZw@mail.gmail.com \
    --to=ablacktshirt@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=elfutils-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).