Re: gdb.mi/mi-cli.exp failures

Daniel Jacobowitz
2003-04-02T18:05:08Z

On Wed, Apr 02, 2003 at 09:44:07AM -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.

> > > Well, I'm afraid that you will have to deal with a number of other
> > > cases if you want to avoid adding sections to input files. Take a
> > > look at elf_link_create_dynamic_sections().
> >
> > In any case I can remove the assumption; it's not hard. I assume that
> > if I save pointers to the sections present before calling
> > elf_link_add_object_symbols, that they'll still be valid when it
> > returns?
>
> Probably. But I personally don't think the add_symbols() routine
> needs to make any guarantees at all, except that if you hook up and
> the sections and call final_link() you will get a linked output file.
> Maybe we should change the name add_symbols() to initial_link().
>
> Ian
>

--
Daniel Jacobowitz
MontaVista Software Debian GNU/Linux Developer