public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Nick Clifton <nickc@redhat.com>
To: Massimiliano Cialdi <cialdi@gmail.com>, binutils@sourceware.org
Subject: Re: embed memory region information into an elf file
Date: Wed, 1 Apr 2020 14:33:22 +0100	[thread overview]
Message-ID: <0dd4faf0-0670-c39a-9e5c-247630852cf3@redhat.com> (raw)
In-Reply-To: <CABgYhWeZtFfSPkigQpWj2dTcV7g2ZbGva-nxJFh1Er5s9bEo9A@mail.gmail.com>

Hi Massimiliano,

> Is there any magic argument of ld, or some plugin, that allows to
> embed the information of memory regions (usually present in the linker
> script) into the elf file?

In short: "no". :-(

> This way I could get the information I need (name, base address and
> size) directly from the elf, and I would no longer need to have the
> linker script (and parse it).

But you can add extra data into ELF files.  For example objcopy has an
--add-section option which could be used to insert a section containing
the required data.  (You would have to decide on the format of the data
and create a file containing the necessary information, but this should
not be too hard).

Cheers
  Nick



      reply	other threads:[~2020-04-01 13:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-31 21:04 Massimiliano Cialdi
2020-04-01 13:33 ` Nick Clifton [this message]

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=0dd4faf0-0670-c39a-9e5c-247630852cf3@redhat.com \
    --to=nickc@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=cialdi@gmail.com \
    /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).