From 379dd9658225106674625254fa36004958819b47 Mon Sep 17 00:00:00 2001 From: Fred Fish Date: Sat, 7 Aug 1993 20:27:19 +0000 Subject: * elfread.c (elf_symtab_read): Properly sort out the bss symbols from the data symbols and give them the correct minimal_symbol_type. Add file static symbols to the minimal symbol table, not just global symbols. Ignore symbols that are section names and file names. * dwarfread.c (add_partial_symbol): Add comment about limitations of DWARF symbols for distinquishing data from bss when adding minimal symbols. Add file local symbols to minimal symbols. --- gdb/elfread.c | 49 ++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 42 insertions(+), 7 deletions(-) (limited to 'gdb/elfread.c') diff --git a/gdb/elfread.c b/gdb/elfread.c index fbe9bc5..af625fe 100644 --- a/gdb/elfread.c +++ b/gdb/elfread.c @@ -235,10 +235,17 @@ elf_symtab_read (abfd, addr, objfile) for (i = 0; i < number_of_symbols; i++) { sym = symbol_table[i]; - /* Select global/weak symbols that are defined in a specific section. - Note that bfd now puts abs symbols in their own section, so - all symbols we are interested in will have a section. */ - if ((sym -> flags & (BSF_GLOBAL | BSF_WEAK)) + /* Bfd flags ELF symbol table STT_SECTION and STT_FILE symbols with + BSF_DEBUGGING. We don't want these in the minimal symbols, so + skip over them. */ + if (sym -> flags & BSF_DEBUGGING) + { + continue; + } + /* Select global/local/weak symbols that are defined in a specific + section. Note that bfd puts abs symbols in their own section, + so all symbols we are interested in will have a section. */ + if ((sym -> flags & (BSF_GLOBAL | BSF_LOCAL | BSF_WEAK)) && (sym -> section != NULL)) { /* Bfd symbols are section relative. */ @@ -252,18 +259,46 @@ elf_symtab_read (abfd, addr, objfile) no way of figuring this out for absolute symbols. */ if (sym -> section -> flags & SEC_CODE) { - ms_type = mst_text; + if (sym -> flags & BSF_GLOBAL) + { + ms_type = mst_text; + } + else + { + ms_type = mst_file_text; + } } else if (sym -> section -> flags & SEC_DATA) { - ms_type = mst_data; + if (sym -> flags & BSF_GLOBAL) + { + if (sym -> section -> flags & SEC_HAS_CONTENTS) + { + ms_type = mst_data; + } + else + { + ms_type = mst_bss; + } + } + else + { + if (sym -> section -> flags & SEC_HAS_CONTENTS) + { + ms_type = mst_file_data; + } + else + { + ms_type = mst_file_bss; + } + } } else { /* FIXME: Solaris2 shared libraries include lots of odd "absolute" and "undefined" symbols, that play hob with actions like finding what function the PC - is in. Ignore them if they aren't text or data. */ + is in. Ignore them if they aren't text, data, or bss. */ /* ms_type = mst_unknown; */ continue; /* Skip this symbol. */ } -- cgit v1.1