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

Ian Lance Taylor
2003-04-02T17:44:14Z

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?

> > 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