Re: RFC: bfd_section should not be NULL in call to prim_record_minimal_*

Joel Brobecker
2012-04-17T23:52:00Z

> Did you audit the other symbol readers?

Here is what I found - not exactly completely pretty, and definitely
shows that it would have been a bad idea to add an assertion ;-).

What it also tells me is that, if some of the code out there
explicitly makes the assumption that the minsym's obj_section
is set, it is wrong. I remember seeing this, but in fact, that
was in elfread.c, where the assumption is true.

| * coff-pe-read.c:
| Says: Used as a last resort if no debugging symbols recognized
|
| - Calls prim_record_minimal_symbol from add_pe_exported_sym
| => No bfd_section => No obj_section.
| Fixing might not be completely straightforward, depends
| (needs deeper investigation)...
|
| * dbxread.c:
| - Calls prim_record_minimal_symbol from read_dbx_dynamic_symtab.
| => No bfd_section.
| Should be possible to fix? Need to re-learn about format first.
|
| * mdebugread.c:
| - Calls prim_record_minimal_symbol_and_info, but sometimes with
| NULL bfd_section. May not always be fixable:
|
| What does the following mean? When can this happen?
| > default:
| > /* This kind of symbol is not associated to a section. */
| > section = -1;
| > bfd_section = NULL;
|
| - The other calls to prim_record_minimal_symbol_and_info (with a NULL
| bfd_class) should be replaceable by a call to record_minimal_symbol,
| which provides the bfd_section (apart from the exception above).
|
| * mips-read.c: Do we still support this format??? (bfd_arch_alpha)
| - read_alphacoff_dynamic_symtab calls prim_record_minimal_symbol
| => No bfd_section.
|
| * somread.c: (pa-hpux format - time to propose deprecation?)
| - som_symtab_read calls prim_record_minimal_symbol => No bfd_section.
| Don't remember SOM format anymore, but maybe fixable.
|
| * coffread.c, machoread.c:
| OK: Calls prim_record_minimal_symbol_and_info with a bfd_section.
|
| * elfread.c:
| OK: Calls prim_record_minimal_symbol_full with a bfd_section.

--
Joel