From: Nick Clifton <nickc@redhat.com>
To: Roland McGrath <roland@redhat.com>
Cc: binutils@sources.redhat.com, gdb-patches@sources.redhat.com
Subject: Re: bfd function to read ELF file image from memory
Date: Fri, 16 May 2003 11:24:00 -0000 [thread overview]
Message-ID: <m3ptmjb0xd.fsf@redhat.com> (raw)
In-Reply-To: <200305140128.h4E1Spw06177@magilla.sf.frob.com> (Roland McGrath's message of "Tue, 13 May 2003 18:28:51 -0700")
Hi Roland,
> But all of that is a bit of a digression. I'm posting now because I
> don't quite know where to put this function even it its
> implementation were perfect. It was by far easier to write it in
> elfcode.h than to put it elsewhere. It gets to use the local helper
> code there, and automagically define 32 and 64 bit flavors, which
> keeps the code quite simple. It would be a lot more hair to put the
> code elsewhere, copy the header swapping code, and do the 32/64
> versions half as cleanly.
>
> The proper way to put it there is to make it yet another bfd target
> vector function. I don't know what all rigamorole is involved in
> doing that, and it seems like overkill for something probably only
> ever used by gdb and only with ELF.
Well since your function is creating a new bfd, one obvious place for
it would be in opncls.c. Have you considered using an interface like
the one provided by BFD_IN_MEMORY ? You could make the in-memory
interface generic and provide different memory accessing functions
(for local memory, remote memory, mmap'ed files, etc).
I do not think that treating this in-memory bfd as a new target is
appropriate, since it is not really a new file format or instruction
set architecture, but a new method of loading (part of) a binary file
into a normal bfd structure.
> Can anyone offer advice on where this function ought to live? If it
> doesn't live in the bfd elf backend, then I'll have to copy or
> hand-integrate some sanity checking and byte-swapping code for ELF
> headers.
I am all for keeping things simple, so if it is easier to put it in
elfcode.h then that is probably where it should live. Given the
probably limited utility of this function it probably ought to be only
conditionally defined, based on the particular configured target or
maybe a configure time switch.
Cheers
Nick
next prev parent reply other threads:[~2003-05-16 11:24 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-05-14 1:28 Roland McGrath
2003-05-16 11:24 ` Nick Clifton [this message]
2003-05-16 21:30 ` Roland McGrath
2003-05-19 10:29 ` Nick Clifton
2003-05-19 20:24 ` Roland McGrath
2003-05-19 20:30 ` Ian Lance Taylor
2003-05-19 20:46 ` Roland McGrath
2003-05-17 5:39 ` Andrew Cagney
-- strict thread matches above, loose matches on Subject: below --
2003-05-14 1:20 Roland McGrath
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=m3ptmjb0xd.fsf@redhat.com \
--to=nickc@redhat.com \
--cc=binutils@sources.redhat.com \
--cc=gdb-patches@sources.redhat.com \
--cc=roland@redhat.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