public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Frederick Virchanza Gotham <cauldwell.thomas@gmail.com>
To: binutils@sourceware.org
Cc: Michael Matz <matz@suse.de>
Subject: Re: Linker : Make a map of typeinfo to vtable
Date: Thu, 25 Jan 2024 23:02:32 +0000	[thread overview]
Message-ID: <CALtZhhMH1Pws8ZU3SMJr4TP1N1mEQjGXYTY-qq-y0iJHZFdv6g@mail.gmail.com> (raw)
In-Reply-To: <CALtZhhNKzsCEsmkpOhguZ-EN7cDBT6UNYZw=ZffcTvN+dChKyg@mail.gmail.com>

On Thu, Jan 25, 2024 at 10:17 AM Frederick Virchanza Gotham wrote:
>
> So, somehow, I need to call 'bfd_final_link' in
> order get the offsets for the vtables inside their section, but then I
> need to append my own array onto the end of the section, and then
> perform the final link.


I've had another idea.

Inside the function "bfd_generic_link_add_one_symbol", I can keep a
record of all vtables and typeinfo's encountered. So before the call
to 'ldwrite', I know how many entries there will be in my array. So
before I call 'ldwrite', I add a new symbol to the readonly section
for my array, calling it "__map_typeinfo_vtable", and I give it the
correct size. I fill my array with all zeroes, except for a 128-Bit
magic number at the beginning: 021fed6674b3ac813273c5909cb7d0ac. So
then after I call 'ldwrite' and have produced the final binary file, I
re-open the binary file and I scan through it until I find my magic
number (i.e. 3c1fed6f74bb6c814173c5409cb7d0aa), and I replace it with
the correct data.

This will work I think. I'm gonna try code it now.

  reply	other threads:[~2024-01-25 23:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-19 22:29 Frederick Virchanza Gotham
2024-01-19 22:52 ` Frederick Virchanza Gotham
2024-01-20 19:44   ` Frederick Virchanza Gotham
2024-01-21  3:27     ` Frederick Virchanza Gotham
2024-01-21 22:35       ` Frederick Virchanza Gotham
2024-01-22 16:50 ` Michael Matz
2024-01-25 10:17   ` Frederick Virchanza Gotham
2024-01-25 23:02     ` Frederick Virchanza Gotham [this message]
2024-01-27 10:56       ` Frederick Virchanza Gotham

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=CALtZhhMH1Pws8ZU3SMJr4TP1N1mEQjGXYTY-qq-y0iJHZFdv6g@mail.gmail.com \
    --to=cauldwell.thomas@gmail.com \
    --cc=binutils@sourceware.org \
    --cc=matz@suse.de \
    /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).