Re: [rfa] Deprecate msymbol.info, add msymbol.bfd_symbol?

Andrew Cagney
2003-10-11T20:42:12Z

> ac says:
>
> sym = lookup_minimal_symbol_by_pc (memaddr);
> if (sym && sym->bfd_symbol is "elf like")
> return (ELF_ST_TYPE (((elf_symbol_type *)
> (sym->bfd_symbol))->internal_elf_sym.st_info) == STT_LOPROC)
> else
> return 0;
>
> Okay, I see. The existing code has a hook in the symbol reader that
> reads the bfd symbol and calls MSYMBOL_SET_SPECIAL to stash some bits in
> msymbol.info for later. You would get rid of the hook or simplify and
> just store a simple pointer in msymbol.bfd_symbol. Have I got that
> right?

Yep!

> Sounds like a great idea to me. A bunch of squirrelly caching and
> casting code would go away.
>
> /* Pass symbol size field in via BFD. FIXME!!! */
> size = ((elf_symbol_type *) sym)->internal_elf_sym.st_size;
> msym = record_minimal_symbol_and_info
> ((char *) sym->name, symaddr,
> ms_type, (void *) size, sym->section, objfile);
>
> Yeah, for this code, you could either have msymbol.size or use the
> information available from msymbol.bfd_symbol. Anything but
> mysmbol.info.

Yep!

>> This could immediatly eliminate two of them. I think the coff version
>> of ARM could also be eliminated if coffread (yea, right ... :-) fully
>> utilized BFD.
>
>
> I'm saying that this code is already dead:
>
> gdb_assert (sizeof (void *) >= sizeof (cs->c_sclass));
> msym = prim_record_minimal_symbol_and_info
> (cs->c_name, tmpaddr, ms_type, (void *) (long) cs->c_sclass,
> sec, NULL, objfile);
>
> I'm not sure about these lines immediately after it:
>
> if (msym)
> COFF_MAKE_MSYMBOL_SPECIAL (cs->c_sclass, msym);
>
> I think you are saying that coffread.c can be made to work using
> the new fields. I don't know whether the existing code works or not,
> I'm juse pointing to the deadness.

Yep!

(COFF_MAKE_MSYMBOL_SPECIAL is currently be used by arm. coffread
doesn't use bfd_canonicalize_symtab so doesn't have access to the bfd
symbol.)

Andrew