From: Daniel Jacobowitz <drow@mvista.com>
To: gdb@sources.redhat.com, binutils@sources.redhat.com, nickc@redhat.com
Subject: Re: gdb.mi/mi-cli.exp failures
Date: Wed, 02 Apr 2003 20:38:00 -0000 [thread overview]
Message-ID: <20030402192740.GA3021@nevyn.them.org> (raw)
In-Reply-To: <m3he9g7muj.fsf@gossamer.airs.com>
On Wed, Apr 02, 2003 at 10:53:08AM -0800, Ian Lance Taylor wrote:
> Daniel Jacobowitz <drow@mvista.com> writes:
>
> > > > Well, do you have another suggestion for how to approach this? We're
> > > > not actually linking; but I need to get the symbols from the input file
> > > > into a symbol table with forged offsets in order to apply relocations
> > > > against them.
> > >
> > > Well, I don't really know the context. If you're not linking, then it
> > > seems to me that you'll be better off avoiding the linking calls. The
> > > add_symbols() call is the first phase of a link, and is expected to be
> > > followed by the second phase of a link; despite the name
> > > add_symbols(), it doesn't just add symbols to a hash table.
> > >
> > > If you really just want to put the symbols into a hash table, can you
> > > just get the symbol table generically and add them to a hash table
> > > yourself?
> >
> > IIRC, then we may get a different kind of hash table than the
> > platform's relocation application functions expect. It's been a little
> > while though.
> >
> > The context is in bfd/simple.c if you want to look at it. The
> > intention is to use this code for both gdb and objdump (they do use it
> > now, to be more accurate) to relocate the contents of debug sections.
> > This is necessary for the general cases of debugging shared objects and
> > unlinked object modules.
>
> In principle, bfd_get_relocated_section_contents() should not expect
> to see the exact same sort of hash table that is generated by
> add_symbols(). It should work with any type of linker hash table. If
> it doesn't work, then linking to a different object file format will
> not work. The same applies to the HOWTO functions, of course.
>
> Of course, in practice linking to a different object file format may
> not be supported. But in general the HOWTO functions can't expect to
> see a linker hash table, since they are also called by the assembler.
> And there is no reason to write get_relocated_section_contents() to
> see a particular type of hash table, because it will never be called
> if you use add_symbols() and final_link().
>
> So while I'm perfectly willing to believe that there is a problem, I
> don't know what it is. It seems to me that the simple.c code ought to
> be able to call _bfd_generic_link_add_symbols(), and we could make
> some guarantees about that specific function. If that doesn't work,
> then why doesn't it?
It appears to work, and fixes one of the two problems. I'll post a
patch in a little while. This doesn't solve the question of freeing
the symbol table; I suppose that using bfd_alloc for it may be the way
to go.
Note that this still isn't ideal, because the symbol table is not
clearly cached in the BFD anywhere; so we'll get a new one each time we
relocate a section. What we really need is to cache the canonicalized
symbol table, I suppose.
Really, BFD isn't set up to work the way I want it to for this
functionality. I don't know what to do to make it better.
--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer
next prev parent reply other threads:[~2003-04-02 20:38 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-03-31 19:35 David Carlton
2003-03-31 20:22 ` Andrew Cagney
2003-03-31 21:08 ` Andrew Cagney
2003-03-31 21:20 ` Andrew Cagney
2003-04-01 1:09 ` Hans-Peter Nilsson
2003-04-01 1:38 ` Ian Lance Taylor
2003-04-01 10:18 ` Nick Clifton
2003-04-01 15:08 ` Andrew Cagney
2003-04-01 15:18 ` Daniel Jacobowitz
2003-04-01 16:22 ` Andrew Cagney
2003-04-01 16:34 ` Daniel Jacobowitz
2003-04-01 17:01 ` Andrew Cagney
2003-04-01 18:03 ` Daniel Jacobowitz
[not found] ` <m31y0mxk8i.fsf@workshop.nickc.cambridge.redhat.com>
2003-04-01 17:09 ` Andrew Cagney
2003-04-01 18:23 ` Daniel Jacobowitz
2003-04-02 17:06 ` Nick Clifton
2003-04-02 17:13 ` Daniel Jacobowitz
2003-04-02 17:21 ` Ian Lance Taylor
2003-04-02 17:28 ` Daniel Jacobowitz
2003-04-02 17:44 ` Ian Lance Taylor
2003-04-02 18:05 ` Daniel Jacobowitz
2003-04-02 20:39 ` Ian Lance Taylor
2003-04-02 20:38 ` Daniel Jacobowitz [this message]
2003-04-02 20:53 ` Ian Lance Taylor
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=20030402192740.GA3021@nevyn.them.org \
--to=drow@mvista.com \
--cc=binutils@sources.redhat.com \
--cc=gdb@sources.redhat.com \
--cc=nickc@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